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 に答える