1
我有一個是在Chrome中工作正常指令,但在IE9它呈現「{{} myappInitials.IconColor」到HTML:角JS指令不呈現內聯樣式在IE9
<tr ng-repeat="person in data.people">
<td class="text-left">
<div myapp-initials="person" ></div>
</td>
</tr>
的指令:
angular.module('myapp.directives', [])
.directive('myappInitials', function() {
return {
restrict: 'A',
template: "<div style='background-color:{{myappInitials.IconColor}}' class='userIconMedium'>{{myappInitials.Firstname.charAt(0) + ' ' + myappInitials.Surname.charAt(0)}}</div>",
scope: {
myappInitials: "="
}
};
});
有一個Plunker here檢查。
這是一個錯誤嗎?
我真的不能測試這個在IE瀏覽器9但你有沒有嘗試過使用'ng-class'? – haki
您也可以使用'ng-style' – ivarni
在這個例子中,將'style'標籤改爲'ng-style'並沒有什麼區別。 –