What is the difference between ng-if and *ng-if in angular2

ngIf is the directive. Because it’s a structural directive (template-based), you need to use the * prefix to use it into templates.

*ngIf corresponds to the shortcut for the following syntax (“syntactic sugar”):

<template [ngIf]="condition">
  <p>
    Our heroes are true!
  </p>
</template>

Equivalent to:

<p *ngIf="condition">
  Our heroes are true!
</p>

See this doc for more details:

  • https://angular.io/docs/ts/latest/guide/structural-directives.html

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)