Utilize the scope's event dispatchers; $emit(name, args)
is specifically used to send events up to parent scopes, while $broadcast(name, args)
will propagate events downwards through the hierarchy.
For catching triggered events, make use of $on(name, listener)
listeners.
Alternatively, you may reference $scope.$parent
to navigate upwards in the chain (or $scope.$parent.$parent
and so on), but this practice is discouraged - it requires looking up the scope hierarchy at a fixed number of levels which could make your code inflexible (imagine altering the scope nesting levels by adding an ng-repeat
somewhere).
In certain cases, you can also incorporate transclusion within the directive - allowing your model to exist outside the isolated scope of the directive, hence facilitating natural access to any controller higher up in the hierarchy (assuming there are no isolated scopes blocking the way).
Refer to the $compile
service documentation for further details on the transclude
property of directives.