我想一次显示JSON文件5中的15个项目。每5人一组应放在一个轮播项目中。 这些项目正在显示,但是轮播的指示器和控件没有响应。
<div class="container-fluid">
<div id="carouselItems" class="carousel slide" data-ride="carousel">
<!--Carousel Indicators-->
<ol class="carousel-indicators">
<li data-target="#carouselItems" data-slide-to="0" class="active"></li>
<li data-target="#carouselItems" data-slide-to="1"></li>
<li data-target="#carouselItems" data-slide-to="2"></li>
</ol>
<!--Carousel Indicators-->
<!--Carousel-->
<div class="carousel-inner">
<div class="carousel-item active">
<div class="card-group">
<div class="card" *ngFor="let product of products$ | slice : 0 : 5">
<img class="card-img-top" src="{{ product.imgUrl }}" alt="Card image cap">
<div class="card-body">
<h5 class="card-title">{{ product.name }}</h5>
<p class="card-text">{{ product.price }}</p>
</div>
</div>
</div>
</div>
<div class="carousel-item">
<div class="card-group">
<div class="card" *ngFor="let product of products$ | slice : 5 : 10">
<img class="card-img-top" src="{{ product.imgUrl }}" alt="Card image cap">
<div class="card-body">
<h5 class="card-title">{{ product.name }}</h5>
<p class="card-text">{{ product.price }}</p>
</div>
</div>
</div>
</div>
<div class="carousel-item">
<div class="card-group">
<div class="card" *ngFor="let product of products$ | slice : 10 : 15">
<img class="card-img-top" src="{{ product.imgUrl }}" alt="Card image cap">
<div class="card-body">
<h5 class="card-title">{{ product.name }}</h5>
<p class="card-text">{{ product.price }}</p>
</div>
</div>
</div>
</div>
</div>
<!--Carousel-->
<!--Carousel Controls-->
<a class="carousel-control-prev" href="#carouselItems" 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="#carouselItems" role="button" data-slide="next">
<span class="carousel-control-next-icon" aria-hidden="true"></span>
<span class="sr-only">Next</span>
</a>
<!--Carousel Controls-->
</div>
轮播控件和指示器与一组静态卡一起使用,但是当我添加* ngFor指令时,它们将停止响应。 我在哪里弄糟?