0
我試着編寫自定義指令角JS,取決於傳入指標的影響的集類元素:爲什麼指令不會設置類?
angular.module('hello', [])
.directive("testCase", function(){
return {
restrict: 'A',
scope: {
'condition': '='
},
link: function (scope, element, attrs) {
switch (scope.condition) {
case "pending":
element.css('color', 'yellow');
break;
case 'active':
element.css('color', 'green');
break;
case "archived":
case "finished":
case "completed":
element.css('color', 'gray');
break;
}
}
}
});
但目錄中不設置類,當我通過參數「活躍」
其不是目錄其指令 – Sajeetharan