谁能解释一下 $scope 和 $rootScope 的区别?
我觉得
$范围:
We can get ng-model properties in particular controller from the particular page by using this.
$根作用域
We can get all ng-model properties in any controller from any page by using this.
这是正确的吗?还是别的?
最佳答案
“$rootScope”是在网页中创建的所有“$scope” Angular 对象的父对象。
$scope 是用 ng-controller
创建的,而 $rootscope 是用 ng-app
创建的。
关于javascript - $scope 和 $rootScope 的区别,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22785775/