It’s crucial to be aware of which scope you are working with at any moment. In the two examples above, there’s only one scope, so scope awareness is not an issue. However, in larger applications, certain sections of the HTML DOM may only have access to specific scopes.
When using the ng-repeat directive, each iteration has access to the current iteration object.
<div ng-app=”myApp” ng-controller=”myCtrl”>
<ul> </div> <script> var app = angular.module(‘myApp’, []);
app.controller(‘myCtrl’, function($scope) { </script>
|
Root Scope in AngularJS is the top-level scope that is available globally across the entire application, shared by all controllers and directives unless overridden by local scopes.