Template variable and Two way Binding || Displaying Data and Handling Events
In this video,I explained template variable and two way Binding in Angular. Feel free to comment. For more, please subscribe and press the BELL icon. Please visit my Angular Playlist. Please visit my Angular Videos. Visit my Facebook Page and Instagram Page.
ts file -
import { Component } from '@angular/core';
@Component ({
selector: 'data',
template: `
<h4> Template Variable <h4>
<input #fname (keyup.enter)="Up(fname.value)" /> <br/> <br/>
<h4> Two-way Binding </h4>
<input [(ngModel)]="mob" (keyup.enter)="KEYup()" />
`
})
export class DataComponent {
Up(fname){
console.log(fname);
}
mob="987654321";
KEYup() {
console.log(this.mob);
}
}
ts file -
import { Component } from '@angular/core';
@Component ({
selector: 'data',
template: `
<h4> Template Variable <h4>
<input #fname (keyup.enter)="Up(fname.value)" /> <br/> <br/>
<h4> Two-way Binding </h4>
<input [(ngModel)]="mob" (keyup.enter)="KEYup()" />
`
})
export class DataComponent {
Up(fname){
console.log(fname);
}
mob="987654321";
KEYup() {
console.log(this.mob);
}
}
Comments
Post a Comment