我正在尝试在有角度的模板中使用引导轮播我有一个数据数组,其中包含要在滑块中显示的图像数组中的每个对象都是
{"path": "the path of the image" ,"id":"the id of the image","class":"active
or empty value"}
现在我的角度代码是:
<div *ngFor="let mySlideImage of mySlideImages">
<div class="item" [className]="'mySlideImage.class'">
<img src="{{mySlideImage.path}}" alt="...">
</div>
</div>
发生了什么事,所有图片都在同一垂直方向播种虽然我尝试使用静态值,但效果很好有什么建议吗?
事实证明这是正确的方法!
<div class="item slider-item"[ngClass]="{
'active': mySlideImage.class == 'active'
}" *ngFor="let mySlideImage of mySlideImages">
<img src="{{mySlideImage.path}}" alt="...">
</div>