如何以角度显示图像? [英] How to display image in angular?
本文介绍了如何以角度显示图像?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
如何以角度显示图像?
<div><img class="images" ng-src="{{./resources/img/new.png}}"/></div>
<div><img class="images" src="./resources/img/new.png"/></div>```
推荐答案
了解角度模板绑定( https://angular.io/guide/template-syntax ).如果您的图片在本地(./resources/img/new.png)之类,则可以使用常规的html源代码
Learn angular template binding (https://angular.io/guide/template-syntax). If you have image in local like (./resources/img/new.png) you can use normal html source tag
<img class="images" src="./resources/img/new.png"/>
或者您的图像来自服务器或动态地来自服务器,那时候您必须像这样绑定
Or your image comes from server or dynamically that time you have to bind that like
img = this.imageSource
<img class="images" src={{img}}/> or
<img class="images" [src]="img"/>
这篇关于如何以角度显示图像?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文