Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Mayankgupta688/db14a303c3f94ee2c85b89b1992ace9e to your computer and use it in GitHub Desktop.
Save Mayankgupta688/db14a303c3f94ee2c85b89b1992ace9e to your computer and use it in GitHub Desktop.
@Component({
selector: 'accessing-template-reference',
template: `
<div>
<input type="text" id="userName" [(ngModel)]="userName" />
</div>
`
})
export class HeroListComponent implements OnInit {
@ViewChild(NgModel) userNameReference: NgModel;
ngAfterViewInit(): void {
this.userNameReference.valueChanges.subscribe(
() => { this.executeOtherFunction() }
)
}
}
@juantxokupul
Copy link

"this.userNameReference,valueChanges.subscribe" > "this.userNameReference.valueChanges.subscribe"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment