Knowledge Management Banner

Knowledge Management Banner

AngularJS : scope vs rootScope : Part 2

$scope
  • $scope is the object where all the model properties, methods are available at controller level.
  • $scope is the binding part between view and controller.
  • All the property assigned to $scope are only available at controller level, they cannot be accessed in other controller.
  • $scope is child of $rootscope and there can be multiple $scope present under $rootscope

$rootscope
  • $rootscope is the object which is at ng-app level.
  • The properties assigned to $rootscope are available anywhere from in any controller.
  • $rootscope is the parent scope.



No comments

Powered by Blogger.