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