import { Component } from '@angular/core';
@Component({
selector: 'app-root',
templateUrl: './app.component.html',
styleUrls: ['./app.component.scss']
})
export class AppComponent {
constructor() { }
Name = 'Hi Adi';
ngOnInit() {
}
changeMyName() {
this.Name = 'Hi JC.Adi';
}
}
<h1>Event Binding example in angular</h1>
<button (click)="changeMyName()">Name is changed on click of this button.</button>
<h1>{{Name}}</h1>
No comments:
Post a Comment