角度2显示图像阵列 [英] angular 2 display array of images
本文介绍了角度2显示图像阵列的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我是Angle 2的新手,我有一个图像数组,并且我想连续显示所有图像,但是即使阵列不为空,也不会显示任何图像 我正在使用代码中所示的img标签
i am new to angular 2 , i have an array of images and i want to display all the images in a row but none of them is being displayed even the array is not empty i am using the img tag as shown in the code
html代码:
<div fxLayout="column">
<div >
</div>
<div fxLayout="row" *ngIf="doneLoadingProjectData" >
<div *ngFor="let image of images" >
<img src='image'/>
</div>
</div>
</div>
推荐答案
在将值分配给src属性时需要使用大括号
Need to use curly brackets when you are assigning value to src attribute
<div *ngFor="let image of images" >
<img src='{{image}}'/>
</div>
或者您可以使用模板表达式:
Or you can use a template expression:
<img [src]="image" />
这篇关于角度2显示图像阵列的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文