1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.
  2. Anuncie Aqui
    Anuncie aqui você Também: fdantas@4each.com.br

Angular V17 / V18: Prospects of @if vs. *ngIf – Will *ngIf be Deprecated in the Future?

Discussão em 'Angular' iniciado por lonecatly, Setembro 27, 2024.

  1. lonecatly

    lonecatly Guest

    In the new version of Angular V17, the @if directive can be used as a replacement for ng-container, which is fantastic. However, sometimes *ngIf is more concise, such as when determining whether to display a button:

    <button *ngIf="loaded">OK</button>


    Therefore, I would like to ask, what is the outlook for *ngIf? Will Angular completely abandon *ngIf in some future version?

    Should we replace all instances of *ngIf with @if now, even though the above code may not look as elegant as before?

    @if(loaded){
    <button>OK</button>
    }

    Continue reading...

Compartilhe esta Página