How do I use $rootScope in Angular to store variables?
How do I use $rootScope to store variables in a controller I want to later
access in another controller? For example:
angular.module('myApp').controller('myCtrl', function($scope) {
var a = //something in the scope
//put it in the root scope
});
angular.module('myApp').controller('myCtrl2', function($scope) {
var b = //get var a from root scope somehow
//use var b
});
How would I do this?
No comments:
Post a Comment