in compileTemplateUrl function of angular.js. the 'controller: null' of derivedSyncDirective cause no controller function stored for that element. so getControllers called in nodeLinkFn(its prelink part) will throw exception so prelink won't be called. see http://plnkr.co/edit/yMcurPowZmxCOv0luE5s I don't understand why 'controller: null' here. Does anybody know it?
Asked
Active
Viewed 352 times
1 Answers
1
You need to pass the controller into the directive if you want the controller referenced by name. So first you need to specify the controller with the directive in the template like this
<div ess-tag ng-controller="TagController">
<span>test</span>
</div>
And in the directive, add require
statement, which tells the controller where to find the injected controller if you want the controller referenced by name:
require: 'ngController',
controller: 'TagController',

zs2020
- 53,766
- 29
- 154
- 219