首页 > 解决方案 > 角度的引导轮播

问题描述

我正在尝试在角度模板中使用引导轮播我有一个数据数组包含我想在滑块中显示它们的图像数组中的每个对象是

{"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>

尽管我尝试使用静态值并且效果很好,但所有图片都垂直播种,这是怎么回事?有什么建议吗?

标签: angulartwitter-bootstrap-3

解决方案


原来这才是真道!

<div class="item slider-item"[ngClass]="{
                    'active': mySlideImage.class == 'active'

                  }" *ngFor="let mySlideImage of mySlideImages">
                    <img src="{{mySlideImage.path}}" alt="...">
                </div>

推荐阅读