-
Notifications
You must be signed in to change notification settings - Fork 27.4k
How to get required controller? #10998
Comments
Have you tried: angular
.module('youAppName')
.controller('myCtrl', function()
{
// controller stuff goes here
}) |
No he means that how can he gain access to the parent controller within his own controller. One way I know how to do this is to use an injected .controller('myCtrl', ['$element', function($element) {
var parentCtrl = $element.parent().controller('diective1');
}]) |
Another workaeound would be using the |
+1 to gkalpak |
I think that injecting required controller is essential to fullfill new style of not using |
@matsko - Your solution works great! |
There's an issue with some discussion about this, let's move it here: One good point that is raised that injecting controllers into controllers might create circular dependencies. |
Here is sample from my directive with my problem
How to get required directive1Ctrl in myCtrl??
The text was updated successfully, but these errors were encountered: