我在尝试显示一些很棒的字体图标时遇到了一些麻烦。我有一些通过 rakefile 用 json 编写的文本,我试图在文本中加入一个很棒的字体图标,但遇到了麻烦,因为文本是在 json 中,我想知道是否有人可以快速查看它并且帮帮我。该图标没有出现,但是在开发工具中,它应该出现的地方有额外的空白区域。
我正在使用 haml,前端有 Angular 。我认为我不需要为此显示 Controller 。我也用 deez nuts 代替了我真正拥有的东西。
我的 rakefile 中的区域是这样的
{
"partial":"message",
"params":{
"primary": true,
"icon": "<i class='fa fa-odnoklassniki'></i>",
"body":" With Deez Nuts as your president, you can have the full assurance of knowing that your country will be awesome "
}
},
应该渲染它的 haml 文件在这里
%div{ 'ng-if' => 'option.params.primary' && 'option.params.icon'}
%div{ 'ng-include' => "'/assets/ng/features/politicians/satire/presidents.html'" }
最佳答案
您的 html 可能被 angular 剥离了。检查输出以确保。您可以将此过滤器添加到您的应用程序以呈现受信任的 html:
.filter('trustedHtml', ['$sce', function($sce){
return function(text) {
return $sce.trustAsHtml(text);
};
}])
然后你可以将它应用到任何数据:{{foo | trustedHtml}}
关于css - 在 json 中实现真棒字体,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32575036/