1

I am trying to mimic an autoplay setting for ngx-siema , using:

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

as described here.

How can I do that? Here is my setup:

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

    ngOnInit() {}

    options: NgxSiemaOptions = {
        selector: ".siema",
        duration: 1000,
        loop: true
    };
}
Towkir
  • 3,889
  • 2
  • 22
  • 41
Tanasos
  • 3,928
  • 4
  • 33
  • 63

1 Answers1

0

So, using the provided service (which provides the init function), I added a next() method with a desired setInterval, as follows:

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);
    }
}
Tanasos
  • 3,928
  • 4
  • 33
  • 63