In this session, we look at the typical Imperative way of:
creating a subscription,
adding the actual observable,
creating a local variable to update when the subscription gets data,
on top of it the limitation and ""freeze"" of the component if the strategy is changed to Onpush
and unsubscribing onDestroy if we follow best practices
All of the above can nicely be taken care of with the Declarative syntax of the Async Pipe, but we will look at why it works by debugging the actual class within the Angular source code. We will also look at something that is not often shared in tutorials online on how to deal and handle AsyncPipe errors both in a good way and in the best way.
We will tie in a hands-on exercise for people to convert a few subscriptions from Imperative to Declarative.