当我使用的是版本v1.2.1时,我的代码工作正常但是当我更改版本v1.4.8时,$ sce无效。
Dim Loc1 As String
Loc1 = "th" & GenerateP1() & "(" & GenerateP2() & ")"
请参阅jsfiddle了解完整代码 http://jsfiddle.net/tridip/jp6oq2tp/6/
指导我在使用ng v1.4.8时在代码中添加什么,因此$ sec应该有效。感谢
答案 0 :(得分:1)
答案 1 :(得分:0)
$sce
。了解更多信息click here
尝试这个,从小提琴中更新
var app = angular.module('myApp',[]);
app.controller("HelloCntl", function ($scope) {
$scope.friends = [
{
name: 0,
phone: '555-1276'},
{
name: 0,
phone: '800-BIG-MARY'},
{
name: 1,
phone: '555-4321'},
{
name: 2,
phone: '555-5678'},
{
name: 2,
phone: '555-8765'}
];
})
app.filter('customFilter', function ($sce) {
return function (number) {
if (isNaN(number) || number > 1) {
return number;
} else {
if (number === 1) {
return $sce.trustAsHtml("✔");
} else if (number === 0) {
return $sce.trustAsHtml("✘");
}
}
}
});