p.location-badge. exported from <a href="/angular2/directives.html">angular2/directives</a> defined in <a href="https://github.com/angular/angular/tree/master/modules/angular2/src/directives/if.js#L33">angular2/src/directives/if.js (line 33)</a> :markdown Removes or recreates a portion of the DOM tree based on an {expression}. If the expression assigned to `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. # Example: ``` <div *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 *if="condition">...</div>` - `<div template="if condition">...</div>` - `<template [if]="condition"><div>...</div></template>` .l-main-section h2 Members .l-sub-section h3 constructor pre.prettyprint code. constructor(viewContainer: ViewContainer) :markdown .l-sub-section h3 condition pre.prettyprint code. condition(newCondition) :markdown .l-sub-section h3 prevCondition :markdown .l-sub-section h3 viewContainer :markdown