angularjs - ng-src requires a non-empty src attribute on img tag -


the documentation ng-src shows using ng-src should work. however, when try use on image, image doesn't show unless have src attribute specified text.

the following not work:

<img ng-src="{{img.url}}" /> 

the following works:

<img src="placeholder_text" ng-src="{{img.url}}" /> 

try

{{img}} 

instead of

{{img.url}} 

http://plnkr.co/edit/z55czxaex92xztkp8nhn?p=preview

when html loading, ngsrc directive should create src attribute url of ng-src attribute. plnkr example:

input html:

<img ng-src="{{img}}" /> 

js:

app.controller('mainctrl', function($scope) {   $scope.name = 'world';   $scope.img = 'http://mawords.com/images/plnkr.co.gif'; }); 

output html

<img ng-src="http://mawords.com/images/plnkr.co.gif" src="http://mawords.com/images/plnkr.co.gif"> 

Comments

Popular posts from this blog

java - How to specify maven bin in eclipse maven plugin? -

single sign on - Logging into Plone site with credentials passed through HTTP -

php - Why does AJAX not process login form? -