angularjs ng=bind-html报错问题

1.angularjs
前台html代码:

js中代码如下:
var app = angular.module('ngappnews', ["businessquery"]);
app.controller("ngControllernews", function ($scope,$sce, $http, businessUtilService, sessions) {
$scope.init = function () {
var data = {
"applySrc": applySrc,
"aac002":$scope.idNumber,
"aac003":$scope.name,
"type":"1"
}
var headers = {
"Authorization": $scope.token
}
businessUtilService.init(data, headers).then(function (response) {
// alert(JSON.stringify(response.data));

        if (response.data == undefined) {
            $scope.isEmpty = true;
        } else {
            if (response.data.length > 0) {

debugger
var dataresult = response.data; //暂定
var maxnum=response.data[0].rowNum; //行号
var array=new Array();
for(var i=0;i // var labelname="ZLCODE"+i;
var ids="ZLTITLE"+i;
array[i]=i;
dataresult[0][ids]=$sce.trustAsHtml(dataresult[0][ids] );
}
$scope.items=dataresult;
$scope.arrays=array; //生成数组
$scope.isEmpty = false;
// $scope.$apply();
} else {
$scope.isEmpty = true;
$(".itemlists").hide();
// $scope.$apply();
}
}
})
}
错误信息:
Error: [$parse:syntax] http://errors.angularjs.org/1.5.8/$parse/syntax?p0=%7B&p1=is%20an%20unexpected%20token&p2=17&p3=items%5B0%5D.ZLTITLE%7B%7B%24index%7D%7D&p4=%7B%7B%24index%7D%7D
at http://localhost:63342/nanning/html/lib/js/angular.min.js:6:412
at s.throwError (http://localhost:63342/nanning/html/lib/js/angular.min.js:230:78)
at s.ast (http://localhost:63342/nanning/html/lib/js/angular.min.js:221:442)
at td.compile (http://localhost:63342/nanning/html/lib/js/angular.min.js:231:329)
at kc.parse (http://localhost:63342/nanning/html/lib/js/angular.min.js:260:95)
at g (http://localhost:63342/nanning/html/lib/js/angular.min.js:125:383)
at Object.compile (http://localhost:63342/nanning/html/lib/js/angular.min.js:274:333)
at oa (http://localhost:63342/nanning/html/lib/js/angular.min.js:71:38)
at s (http://localhost:63342/nanning/html/lib/js/angular.min.js:59:121)
at s (http://localhost:63342/nanning/html/lib/js/angular.min.js:59:253)


OK

说明:后台的数据是通过webservice返回的json串,如果存在多条数据的时候,返回的数据是放到一个大对象里,结构如code0,code1,这种的
麻烦大家帮忙看下。

2个回答

已解决,将转换后的html放到数组中,进行循环

Csdn user default icon
上传中...
上传图片
插入图片
抄袭、复制答案,以达到刷声望分或其他目的的行为,在CSDN问答是严格禁止的,一经发现立刻封号。是时候展现真正的技术了!
立即提问