Close subscription on condition with takeUntil()
问题 I have a subscription to get providers from a NgRx reducer. I want to use takeUntil() to automatically close the subscription when is finally returns an array that has content: // Fetch providers this.store.pipe(select(reducer.getProviders)) // .takeUntil(reducer.getProviders.length > 0) .subscribe(providers => { if (providers) { this.providers = providers; // takeUntil(/** something **/); } }); Can someone help me with this? I can't figure out how to make use of takeUntil() 回答1: takeUntil