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
-
- @Directive(selector: '[ngIf]')
Constructors
- NgIf(ViewContainerRef _viewContainer, TemplateRef _templateRef)
Properties
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