是否使用了指令的 link 函数的 return 值?
Is the return value of the link function of a directive used?
是否使用了指令link
函数的return值?
我正在使用 AngularJS 1.4.
这个问题源于看到一个对象被新建,然后从 link
函数 returned。
例如,来自指令定义:
// ...
link: function(scope, $element, attrs, ngModelController) {
return new Link(scope, $element, $window, ngModelController);
},
// ...
好像没用过
为了检查它,我设置了 this simple plunker example,写了一个只有 debugger;
的虚拟指令来设置断点,例如
app.directive('myDirective', function(){
return {
link: function(scope){
debugger;
}
}
});
虽然 运行 它,我使用 F12 键打开了调试工具,当在调用堆栈中查找时,发现没有人使用的返回值link 函数调用
是否使用了指令link
函数的return值?
我正在使用 AngularJS 1.4.
这个问题源于看到一个对象被新建,然后从 link
函数 returned。
例如,来自指令定义:
// ...
link: function(scope, $element, attrs, ngModelController) {
return new Link(scope, $element, $window, ngModelController);
},
// ...
好像没用过
为了检查它,我设置了 this simple plunker example,写了一个只有 debugger;
的虚拟指令来设置断点,例如
app.directive('myDirective', function(){
return {
link: function(scope){
debugger;
}
}
});
虽然 运行 它,我使用 F12 键打开了调试工具,当在调用堆栈中查找时,发现没有人使用的返回值link 函数调用