Original Post: https://blog.lacolaco.net/2020/02/async-pipe-initial-null-problem-en/
Angular's AsyncPipe is a useful feature for template binding ...
For further actions, you may consider blocking this person and/or reporting abuse
Null is bad.
The checks etc. that is required for asyncPipe makes it unreliable, since the expected type changes.
Yes we can code around it with conditionals, but that's more akin to mitigation. :/
Unfortunately my impression is that the only real fix' here is to not use async pipe.
Return types should be reliable.
Nice article, coincidentally I recently wrote up something very similar: dev.to/angular/handling-observable...
Wow, really coincidentally! I'll add a link to recommend your article!
Great explanation, Suguru! Would you like to publish it on Angular inDepth?
One observation: To use RxSubscribeDirective with NgForOf, we would have to do a nested structual directive.
Thank you Lars! Yes, I'd love to!
As you says,
*rxSubscriveand*ngForor other structural directives cannot be at the same place. I recommend adding<ng-container *rxSubscribe>at the root for subscribing to a stream.Come to our Slack workspace, and Max will set you up on the new site π
I think it would be useful to show an example with a for loop such as:
Did you consider supporting microsyntax? Something like
Maybe even
This is certainly an Angular In Depth standard of articleπ