1
我想在鏈接功能中使用指令特定的控制器和父控制器。Angular JS指令特定的控制器和父控制器
module.directive('parent', function() {
return {
...
controller: SomeFunction
}
}
module.directive('child', function() {
return {
...
require('^parent'),
controller: SomeOtherFunction,
link: function(scope, element, attr, ctrl) {
//ctrl is the parent controller not the SomeOtherFunction
}
}
}
有沒有辦法我可以使用directiveSpecificController,但也有權訪問父控制器?