96 lines
1.4 KiB
Plaintext
Raw Normal View History

2015-06-01 22:51:00 -07:00
p.location-badge.
exported from <a href='../directives'>angular2/directives</a>
defined in <a href="https://github.com/angular/angular/tree/3a0410a/modules/angular2/src/directives/ng_if.ts#L3-L50">angular2/src/directives/ng_if.ts (line 3)</a>
2015-06-01 22:51:00 -07:00
:markdown
Removes or recreates a portion of the DOM tree based on an {expression}.
2015-06-02 09:05:05 -07:00
If the expression assigned to `ng-if` evaluates to a false value then the element
is removed from the DOM, otherwise a clone of the element is reinserted into the DOM.
2015-06-01 22:51:00 -07:00
# Example:
```
<div *ng-if="errorCount > 0" class="error">
<!-- Error message displayed when the errorCount property on the current context is greater
than 0. -->
{{errorCount}} errors detected
</div>
```
# Syntax
- `<div *ng-if="condition">...</div>`
- `<div template="ng-if condition">...</div>`
- `<template [ng-if]="condition"><div>...</div></template>`
.l-main-section
h2 Members
.l-sub-section
h3 constructor
pre.prettyprint
code.
constructor(viewContainer: ViewContainerRef, protoViewRef: ProtoViewRef)
:markdown
.l-sub-section
h3 viewContainer
2015-06-01 22:51:00 -07:00
:markdown
.l-sub-section
h3 protoViewRef
2015-06-01 22:51:00 -07:00
:markdown
.l-sub-section
h3 prevCondition
2015-06-01 22:51:00 -07:00
:markdown
.l-sub-section
h3 ngIf
2015-06-01 22:51:00 -07:00
:markdown