查看
<li ng-repeat="avatar in avatars" style="background-image: url(images/{{avatar.bg}})">
<i>{{avatar.icon}}</i>
</li>
<li><i></i></li>
Controller
.controller('AboutCtrl', function($scope) {
$scope.avatars = [
{"icon": "", "bg": "github.jpeg", "href": "http://google.com"},
{"icon": "", "bg": "twitter.jpeg", "href": "http://google.com"},
{"icon": "", "bg": "gplus.jpg", "href": "http://google.com"},
{"icon": "", "bg": "fb.jpg", "href": "http://google.com"}
];
})
问题
我在CSS文件中使用@font-face添加了“Font Awesome”字体,然后将其设置为所有<i>
元素的字体。但是,当我使用Angular通过“avatar.icon”将特殊字符值插入到<i>
元素时,我的字体不会呈现。
我添加了第二个<li>
组以确保它确实是Angular而不是CSS特异性问题,但第二个<i>
标记中的特殊字符完全正常呈现。
我知道我忽略了什么,但我想不出来。谢谢您的帮助。
\uf09b
而不是写入
。您不再需要使用ng-bind-html
,只需使用常规绑定即可。 - Miral