I have an angular (9) component which gets BehaviourSubjects. I learn from many sources like this to use the async
-pipe when displaying observables content (instead of subscribing it in ngInit). There's also the trick, using *ngIf*
with as
to not repeat it all the time. But since they are BehaviourSubjects after all, I could could simply do
<div>{{behaviourSubject.getValue()}}</div>
or whatever. Actually it's seems much cleaner to me then using 'async' and practically leads to less problems here and there. But I am nor sure if this is an okay pattern or has it serious disadvateges?