How can I use a registered controller in my angular directive?

后端 未结 2 1275
没有蜡笔的小新
没有蜡笔的小新 2021-01-11 11:56

I have a controller registered like this:

myModule.controller(\'MyController\', function ($scope, ...some dependencies...)
{
    ....

Using

2条回答
  •  渐次进展
    2021-01-11 12:17

    It appears that you can just use:

    controller: 'MyController' 
    

    IF the controller is in the same module as the directive or a higher level module composed of the module with the directive in it.

    When I tried it with two different modules composed into an app module (one for the controller and one for the directive), that did not work.

提交回复
热议问题