I am completely new to AngularJS. In the code I am supposed to add a feature to I can see $scope.$parent I know about $scope. I also know that when I see a $ it means it is built-in angular. So I searched for it in Angular web site but I did not have any luck finding anything about $Parent as a built-in service or factory or directive, etc... Can anybody help me understand what it means. Also how I can get to an answer in their documentation when I run into something new?
The documentation for $parent is sparse, but you can find it referenced here at the very bottom of the page.
$scope.$parent refers to the $scope of the parent element. E.g. if you have an element with a controller nested within another element with it's own controller:
<div ng-controller="parentController">
... something in the parent element
<div ng-controller="childController">
... something in the child element
</div>
</div>
You can access variables attached to the parentController from the childController using $scope.$parent. and use them in the child element.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With