现在我正在使用我并不真正关心的setTimeout()
。有本地运营商吗?我试过delay
但是没有用?
import { Component, Input, OnInit } from '@angular/core';
import { Observable } from 'rxjs/Observable';
export class CarouselListComponent implements OnInit {
public active = 0;
@Input() public delay = 0;
@Input() public interval = 5500;
public ngOnInit(): void {
setTimeout(()=> {
Observable.interval(this.interval).subscribe(()=> {
++this.active;
});
}, this.delay);
}
}