DEV Community

Dionis Dimcea
Dionis Dimcea

Posted on

Angular @if

Angular has released the new '@if' block syntax inspired by Javascript

How does this work?

@if

Similar to JavaScript's if statement, Angular uses @if to conditionally hide and show part of a template and its contents

Angular ngIf alternative
@else

When you need a fallback, similar to JavaScript's else clause, add an @else block to accomplish the same effect

Angular ngIf else alternative

Angular docs

Top comments (0)

👋 Kindness is contagious

Discover a treasure trove of wisdom within this insightful piece, highly respected in the nurturing DEV Community enviroment. Developers, whether novice or expert, are encouraged to participate and add to our shared knowledge basin.

A simple "thank you" can illuminate someone's day. Express your appreciation in the comments section!

On DEV, sharing ideas smoothens our journey and strengthens our community ties. Learn something useful? Offering a quick thanks to the author is deeply appreciated.

Okay