NgIf class

Causes an element and its contents to be conditionally added/removed from the DOM based on the value of the given boolean template expression.

For details, see the ngIf discussion in the Template Syntax page.

Examples

<hero-detail *ngIf="isActive"></hero-detail>
<div *ngIf="hero != null" >{{hero.name}}</div>
<template [ngIf]="hero != null">
  <div>{{hero.name}}</div>
</template>
Annotations

Constructors

NgIf(ViewContainerRef _viewContainer, TemplateRef _templateRef)

Properties

hashCode int
The hash code for this object.
no setterinherited
ngIf bool
Whether the content of the directive should be visible.
no getter
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() String
A string representation of this object.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited