out put variables in the template filehtml
export class HeaderComponent{ //property appTitle: string = 'Angular'; version: number = 4; //method getVersion(){ return this.version; } }
<h3>{{ appTitle }}_{{ getVersion() }}</h3>
edit name.component.tsapp
status = false;
<button [disabled]="status">Button</button> <!-- or do this--> <img [src]="bannerImg">
changeMessage(){ this.message = 'new content has been posted!'; } updateContent(event: any){ this.content = event.target.value; }
<p>message: <i> {{message}}</i></p> <p>preview: <i>{{content}}</i></p> <input type="text" (input)="updateContent($event)"> <button (click)="changeMessage()">post</button>
<input type="text" class="form-control" [(ngModel)]="content"> <p>{{content}}</p>
content: string = 'empty';