Two directives are nested within each other, with one requiring the other using require: '^parentTag'
. Both directives have their own controllers. In the parent directive, I can access its controller as the fourth argument in
link: function(scope, el, attrs, ctrl)
, but in the child directive, this fourth argument either refers to the required controller or an array of required controllers, making it impossible to access the directive's controller.
I have attempted to access the controller by using the name specified in controllerAs 'vm'
and also by using the string name for the controller, but neither method successfully retrieves the controller into the fourth argument.
Although the controller is accessible through scope.vm
, I would prefer to access it via the fourth argument if feasible.
This Plunkr example demonstrates that the ChildController does not appear in the fourth argument, only on the scope, whereas the ParentController is accessible as the fourth argument.