angularjs - using {{}} binding inside ng-src but ng-src doesn't load

后端 未结 2 1438
佛祖请我去吃肉
佛祖请我去吃肉 2021-02-03 17:16

I have been trying to bind a value to the ng-src of an img HTML element to no avail.

HTML code:


      
2条回答
  •  无人共我
    2021-02-03 17:52

    We can use ng-src but when ng-src's value became null, '' or undefined, ng-src will not work. So just use ng-if for this case:

    http://jsfiddle.net/Hx7B9/299/

提交回复
热议问题