The ng-app directive is placed at the root element in a application, example: in the <html> tag, <body> tag or in root of master page ...
How to define ng-app in javascript ?
<script>
myWebApp = angular.module('myWebApp', []);
myWebApp .controller("controller_name", function($scope){
$scope.blogurl="http://ui-tutorials.blogspot.com/";
});
</script>
How to use ng-app?
example 1:
<body ng-app="myWebApp" ng-controller="HomeCtrl">
<p>Welcome to {{blogurl}}</p>
</body>
example 2:
<html ng-app="myWebApp" ng-controller="ContactCtrl">
<div>Welcome to {{blogurl}}</div>
</html>
No comments:
Post a Comment