Showing posts with label $rootScope. Show all posts
Showing posts with label $rootScope. Show all posts

Monday, July 6, 2015

$rootScope service in AngularJS

$rootScope is the global scope which acts as the parent for all the controllers $scope, values set in one controller’s $scope can be accessed in other controllers $scope across the application.

The following example defines 2 controllers, the 1st controller sets value for the variable rootValue and the 2nd controller accesses the value from the rootScope and displays it in the view.