I've created a structural directive to show loader when there is no data, however I cannot make "as" syntax work (i.e. asyncData$ | async as data
).
I've created a StackBlitz example.
Here when you click on button it sends data to BehaviorSubject
.
If I use ngIf
it works but not with my own directive.
<pre *loader="name | async as b">
!{{ b | json }}!
</pre>
<hr>
ngIf
<pre *ngIf="name | async as b">
!{{ b | json }}!
</pre>
<br>
<button (click)="handler()">Load data</button>
This question being considered as "off-topic" whilst it's not.
I've created a sample code. It doesn't work, while showing my attempt to solve the issue. The issue is fully connected to the code itself.