I have a directive written by another developer that basically has the following configuration:
{ controller: MyController, controllerAs: 'myController', link: function(scope, $element, attrs, ctrl) { // Does some setup that requires controller } }
This works fine, the controller is passed as the fourth argument, the directive works.
Now I decided to make the directive more flexible, reusable, etc. So, for directory configuration, I added
require: '?ngModel'
Suddenly, my controller is never transferred to the communication function. There is no array for the fourth argument, there is no fifth argument, nada.
I tried adding a controller to the require directive, but it still doesn't find it.
How to add require and pass the controller?
source share