I am using Angular2 -RC2. This is how I use * ngIf, maybe this helps. NOTE: in this example, after clicking the button, it will be disabled, so you cannot click it to call unpushMe () again.
text-area.component.ts
import {Component} from '@angular/core'; @Component({ selector: 'textarea-comp', template: ` <div> <div *ngIf="!isPushed" > <p><button (click)="pushMe()">push2disable</button></p> </div> <div *ngIf="isPushed" > <p><button (click)="unPushMe()" disabled >disabled</button></p> </div> ` }) export class TextAreaComponent { isPushed: boolean = false; pushMe() { this.isPushed = true; } unPushMe() { this.isPushed = false; } }
source share