Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
constructor() {
this.intervalService.interval$
.pipe(
untilDestroyed(this),
finalize(() =>
console.log('IntervalComponent intervalService.interval$ stream has completed')
)
)
.subscribe(value => {
console.log(`IntervalService emitted value inside component ${value}`);
this.valueFromIntervalService = value;
});
}
constructor() {
interval(1000)
.pipe(untilDestroyed(this, 'destroy'))
.subscribe(value => {
console.log(`IntervalService emits value ${value}`);
this.interval$.next(value);
});
}
constructor() {
new Subject()
.pipe(
untilDestroyed(this),
finalize(() => {
this.disposed = true;
})
)
.subscribe();
}
}
constructor() {
new Subject()
.pipe(
untilDestroyed(this),
finalize(() => {
this.disposed = true;
})
)
.subscribe();
}
}