DEV Community

loading...

Discussion on: Use "async as" to cleanup Angular templates

Collapse
constjs profile image
Piotr Lewandowski • Edited

I'd like to see directive for this in Angular core ;)

*ngIf has drawback to check falseness of value.
For example when observed values are numbers, when value comes by and is 0, it will never be shown.

<span *ngIf="counter$ | async as counter">
    Hello {{ counter }}
</span>

This is something to know to avoid surprises. ;)