2

所以,我已经使用了ng-src指令,但从未使用绝对图像 URL。现在我是,我有问题。Angular 似乎试图将 URL 评估为对我来说没有任何意义的表达式。

这是标签:

<img ng-src="{{message.logo_url}}" ng-show="{{message.logo_url}}">

这是错误消息:

Error: Syntax Error: Token ':' is an unexpected token at column 5 of the expression [http://m.c.lnkd.licdn.com/mpr/mpr/p/2/000/0ad/2dd/0511c49.png] starting at [://m.c.lnkd.licdn.com/mpr/mpr/p/2/000/0ad/2dd/0511c49.png].
    at Error (<anonymous>)
    at throwError (http://localhost:8080/customer/service/gui/app/bower_components/angular/angular.js:6671:11)
    at parser (http://localhost:8080/customer/service/gui/app/bower_components/angular/angular.js:6663:5)
    at http://localhost:8080/customer/service/gui/app/bower_components/angular/angular.js:7281:29
    at compileToFn (http://localhost:8080/customer/service/gui/app/bower_components/angular/angular.js:9214:16)
    at Object.Scope.$watch (http://localhost:8080/customer/service/gui/app/bower_components/angular/angular.js:8546:19)
    at http://localhost:8080/customer/service/gui/app/bower_components/angular/angular.js:15580:11
    at nodeLinkFn (http://localhost:8080/customer/service/gui/app/bower_components/angular/angular.js:4959:13)
    at compositeLinkFn (http://localhost:8080/customer/service/gui/app/bower_components/angular/angular.js:4550:15)
    at compositeLinkFn (http://localhost:8080/customer/service/gui/app/bower_components/angular/angular.js:4553:13) <img ng-src="{{message.logo_url}}" ng-show="{{message.logo_url}}"> angular.js:6349
(anonymous function) angular.js:6349
(anonymous function) angular.js:5420
nodeLinkFn angular.js:4962
compositeLinkFn angular.js:4550
compositeLinkFn angular.js:4553
compositeLinkFn angular.js:4553
publicLinkFn angular.js:4455
ngRepeatAction angular.js:15462
$watchCollectionAction angular.js:8717
Scope.$digest angular.js:8811
Scope.$apply angular.js:9012
done angular.js:10265
completeRequest angular.js:10449
xhr.onreadystatechange angular.js:10404

如果您还需要什么,请告诉我。

4

1 回答 1

3

改用这个:

<img ng-src="{{message.logo_url}}" ng-show="message.logo_url">

ngShow的文档中所述。

于 2013-07-12T13:02:59.617 回答