ngx-siema如何设置间隔

ngx-siema how to set interval

我正在尝试模仿 ngx-siema 的自动播放设置,使用:

setInterval(() => mySiema.next(), 1000)

如所述here

我该怎么做?这是我的设置:

export class SliderComponent implements OnInit {
    constructor(private ngxSiemaService: NgxSiemaService) {}

    ngOnInit() {}

    options: NgxSiemaOptions = {
        selector: ".siema",
        duration: 1000,
        loop: true
    };
}

因此,使用提供的服务(它提供了 init 函数),我添加了一个 next() 方法和所需的 setInterval,如下所示:

export class SliderComponent implements OnInit {
    constructor(private ngxSiemaService: NgxSiemaService) {}

    ngOnInit() {
        this.next();
    }

    options: NgxSiemaOptions = {
        selector: ".siema",
        duration: 1000,
        loop: true
    };

    next() {
        setInterval(() => {
            this.ngxSiemaService.next(1);
        }, 3000);
    }
}