I have a controller that's inside another controller.
<div ng-controller="post">
<div ui-if="isAllowed">
<footer ng-controller="footer"></footer>
</div>
</div>
I believe the ui-if creates a new scope so there's 3 scopes here.
I want the footer controller to be able to access the scope of post.
.controller('post', function($scope) {
$scope.foo = "bar"
})
I can easily do $scope.$parent.$parent.foo
but I read that scopes are supposed to automatically inherit from the parent, and the parent thing is just super unwieldy.
Quote from Angularjs wiki:
(If you really want to share data via controllers scope inheritance, there is nothing you need to do. The child scope will have access to all of the parent scope properties. See also Controller load order differs when loading or navigating)
How do I access foo from the footer scope?