Accessing Parent Controller Scope in Child Controller in AngularJS | AngularJS Parent Controller Scope in Child Controller | AngularJS Tutorial

We can accessing Parent Controller Scope in Child Controller in AngularJS using $parent in $scope. Let us see an example below:
 If your HTML is like below you could do something like this:
<div ng-controller="ParentCtrl">
    <div ng-controller="ChildCtrl">
    </div>
</div>
Then you can access the parent scope as follows
function ParentCtrl($scope) {
    $scope.cities = ["NY", "Amsterdam", "Barcelona"];
}

function ChildCtrl($scope) {
    $scope.parentcities = $scope.$parent.cities;
}
If you want to access a parent controller from your view you have to do something like this:
<div ng-controller="xyzController as vm">
   {{$parent.property}}
</div>