Angular Bootstrap轮播无法处理动态内容

时间:2018-08-13 08:23:22

标签: angular twitter-bootstrap carousel angular6

我实施了一个引导轮播,并使用静态ID正常工作, 当我尝试动态添加Carousel的块数时,该Carousel无法正常工作。

<!-- Property Image Caurosel -->
<div class="row">
  <div class="col-md-12">
      <div id="propertyFloorPlansCarousel{{pui}}" class="carousel slide" data-ride="carousel">
          <ol class="carousel-indicators">
            <li *ngFor="let photo of property.propertyFloorPlans;let i=index;let isFirstRow=first" data-target="#propertyFloorPlansCarousel" data-slide-to="i" [ngClass]="{'active' : isFirstRow}"></li>
          </ol>
          <div class="carousel-inner">
            <div *ngFor="let photo of property.propertyFloorPlans;let isFirstRow=first" class="carousel-item " [ngClass]="{'active' : isFirstRow}" >
              <img class="d-block w-100" src="{{photo.url}}" alt="Property Image">
            </div>
          </div>
          <a class="carousel-control-prev" href="#propertyFloorPlansCarousel{{pui}}" role="button" data-slide="prev">
            <span class="carousel-control-prev-icon" aria-hidden="true"></span>
            <span class="sr-only">Previous</span>
          </a>
          <a class="carousel-control-next" href="#propertyFloorPlansCarousel{{pui}}" role="button" data-slide="next">
            <span class="carousel-control-next-icon" aria-hidden="true"></span>
            <span class="sr-only">Next</span>
          </a>
      </div>
  </div>
</div>
<!-- end of caurosel -->

这里{{pui}}通过循环动态出现。 感谢您的帮助。

0 个答案:

没有答案