I have the following custom operator:
export function test() {
return function(source) {
return new Observable(observer => {
return source.subscribe({
next(value) {
observer.next(value);
},
error(error) {
observer.error(error);
},
complete() {
console.log('completed')
observer.complete();
}
})
});
}
}
The problem is that when I subscribe to an observable that completes I didn't get to the complete callback, i.e I don't see the completed log.
interval(1000).pipe(
test(),
take(2)
).subscribe();
What am I missing?