angular - 角度的引导轮播
问题描述
我正在尝试在角度模板中使用引导轮播我有一个数据数组包含我想在滑块中显示它们的图像数组中的每个对象是
{"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>
推荐阅读
- postgresql - Docker postgreSQL entrypoint-initdb.d 选择数据库
- python - 如何在 matplotlib 网格的特定单元格中着色?
- python - Python reverse listener using threading
- angular - Return a blob from an observable
- python - 如何在 django 模型方法中将连接函数作为参数传递
- postgresql - Postgres 更新行并在高竞争下返回原始数据
- azure - 从 azure blob 插入数据并根据 blob 的名称插入 Azure 数据工厂中的某个表
- r - 如何在r中获取时间序列中的特定日期
- c# - 如何从 C# 中的动态 XML 中读取特定值?
- c# - 使用具有复杂过滤器语法的外部 API