Difference between $scope and $rootScope

后端 未结 9 1810
孤城傲影
孤城傲影 2020-11-28 02:33

Can anyone explain the difference between $scope and $rootScope?

I think

$scope:

We can get ng-model properties in particular cont

9条回答
  •  悲哀的现实
    2020-11-28 03:06

    Both are Java script objects and the difference is illustrated by diagram as below.

    NTB:
    First angular application try to find the property of any model or function in $scope , if it doesn't found the property in $scope , then it search in parent scope in upper hierarchy. If the property is still not found in upper hierarchy then angular tries to resolve in $rootscope.

提交回复
热议问题