Friday, August 26, 2016

Angular JS in Scope



  • -binding part
  • properties and methods
  • both view and controller


<script src="http://ajax.googleapis.com/ajax/libs/angularjs/1.4.8/angular.min.js"></script>
<body ng-app="myApp">

<p>The rootScope's favorite color:</p>
<h1>{{color}}</h1>


<script>
var app = angular.module('myApp', []);
app.run(function($rootScope) {
    $rootScope.color = 'blue';
});

</script>

No comments:

Post a Comment