나는 내가 찾을 수있는 모든 것에 대해 시도해 보았고,이 구간을 구독 내부에서 코드하는 것을 멈추는 것처럼 보이지는 않는다. 간격을 잘못 사용하고 있습니까? 에서Observable interval을 멈출 수 없다
var subject = new Subject();
var interval = Observable.interval(this.settings.timing * 1000);
var subscription = interval
.takeUntil(subject)
.subscribe(t => {
console.log('pushing new item');
this.activeItems[0].contentLeaving = true;
setTimeout(()=>{
this.activeItems[0].imageLeaving = true;
setTimeout(()=>{
this.activeItems.push(this.activeItems.shift());
setTimeout(()=>{
this.activeItems[1].contentLeaving = false;
this.activeItems[1].imageLeaving = false;
},510);
},510);
},510);
});
this.moduleProps.intervals.push(subject);
내
this.moduleProps.intervals.forEach((i)=>{
i.complete();
});
그러나 ngOnDestroy
이 난 아직도 콘솔 로그 문은 여전히 내 간격에서 실행중인 것처럼 "새 항목을 밀어"라고 볼 일 후.
당신은()()'안에'가입 subscription.unsubcscribe'호출 할 수 있습니다 다음이다. 또는 어쩌면 나는 당신이하고 싶은 것을 이해하지 못한다 ... – martin