图片是通过服务器请求得到的,PHP测试正确,页面也是通过服务器端打开的,同样请求的其他数据文字之类的没有错误,可以正常显示,就只是图片出错,当单独测试的时候会出现图片详情,代码截图如下:
当代码是如下情况的时候,就会报错:
当注释掉img所在行的时候,其他数据正常显示
报错浏览器控制台错误代码如下:
angular.js:12314 Error: [$interpolate:noconcat] Error while interpolating: img/{{dish.img_sm}}
Strict Contextual Escaping disallows interpolations that concatenate multiple expressions when a trusted value is required. See http://docs.angularjs.org/api...$sce
http://errors.angularjs.org/1...$interpolate/noconcat?p0=img%2F%7B%7Bdish.img_sm%7D%7D
at http://127.0.0.1/12-1AngularJS_project/js/angular.js:68:12
at Function.$interpolateMinErr.throwNoconcat (http://127.0.0.1/12-1AngularJS_project/js/angular.js:10572:9)
at $interpolate (http://127.0.0.1/12-1AngularJS_project/js/angular.js:10824:30)
at addAttrInterpolateDirective (http://127.0.0.1/12-1AngularJS_project/js/angular.js:8483:27)
at collectDirectives (http://127.0.0.1/12-1AngularJS_project/js/angular.js:7621:13)
at compileNodes (http://127.0.0.1/12-1AngularJS_project/js/angular.js:7448:22)
at compileNodes (http://127.0.0.1/12-1AngularJS_project/js/angular.js:7464:15)
at compileNodes (http://127.0.0.1/12-1AngularJS_project/js/angular.js:7464:15)
at compileNodes (http://127.0.0.1/12-1AngularJS_project/js/angular.js:7464:15)
at compileNodes (http://127.0.0.1/12-1AngularJS_project/js/angular.js:7464:15) <div ng-view="" class="ng-scope">
这个是插值出现了连接错误,你试下
<img ng-src="{{'img/' + dish.img_sm}}">
,这样就可以了。