我如何使用$rootScope
将变量存储在我想稍后在另一个控制器中访问的控制器中?例如:
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
});
我该怎么做?