我在Angular 7中使用ngu-carousel创建了一个图像滑块。图像随机旋转,有时出现相同的图像。但是我需要根据顺序旋转图像。
我的代码如下。
ngOnInit() {
this.tempData = [];
this.carouselTileItems$ = interval(500).pipe(
startWith(-1),
take(30),
map(val => {
const data = (this.tempData = [
...this.tempData,
this.imgags[Math.floor(Math.random() * this.imgags.length)]
]);
return data;
})
);
}
如何根据我的要求更改此代码。