0
如何從鏈接功能訪問與指令相關的控制器實例?如何從鏈接功能訪問與指令相關的控制器實例?
return {
template: template,
controller: controller,
controllerAs: 'myCtrl', // How do I access the controller instance from the link function?
restrict: 'E',
replace: true,
link: function(scope, element, attrs) {}
};
爲什麼要這麼做? – Subash
我想通過傳遞''ctrls''作爲第四個參數來鏈接函數。 –