Пытался сделать простой таймер и нужно сломать его по какому-то if
условию. Но всегда выдавал ошибку EXCEPTION: timer.unsubscribe is not a function
.
Что я делаю не так?
let timer:any = Observable.timer(0,1000);
timer.subscribe(data => {
console.log(this.itemsRatedList);
if(data == 5) timer.unsubscribe();
});