Luke Flournoy Luke Flournoy - 1 month ago 19
AngularJS Question

scope resolution operator angularjs

Is there a way to use a scope resolution operator, like in c++, to use a parent $scope variable instead of the one in the current $scope.

I have two controllers, a Root ctrl and a Settings Ctrl. The Settings Ctrl is the child controller of Root ctrl so inherits it's variables. Both Controllers have a variable named $scope.users. Is there a way I can bypass this $scope.user in the settings ctrl(child controller) and use the one in the root ctrl (parent controller)?

Answer

In your child controller you can access the parent controller variable as

$scope.$parent.users
Comments