Tag Archives: AngularJS $rootScope and $scope

AngularJS

AngularJS Agenda Definition, History Define the features and Components Step of creation of Angular JS Application AngularJS – Directives. AngularJS – Expressions. AngularJS – Modules. AngularJS – Controllers. Angular JS – Two way data binding. Angular JS – Ng-repeat and Neatest Ng-repeat. Angular JS – Events Handling AngularJS – Filters. AngularJS – HTML DOM. AngularJS… Read More »

AngularJS $rootScope and $scope

$scope cannot be used outside the controller whereas $rootScope can be used anywhere, no matter what controller you are in $rootScope is available globally. All other $scopes are children of the $rootScope. Example: <html > <head runat=”server”> <title></title> <script src = “http://ajax.googleapis.com/ajax/libs/angularjs/1.3.14/angular.min.js”></script> <script type=”text/javascript”> var app = angular.module(‘myApp’, []); app.controller(‘myCtrl1’, function ($scope, $rootScope) { $scope.num1… Read More »