Skip to content

Instantly share code, notes, and snippets.

@Mayankgupta688
Created September 9, 2019 10:47
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/86cc2ea1000605e7e04edb6d1b365969 to your computer and use it in GitHub Desktop.
Save Mayankgupta688/86cc2ea1000605e7e04edb6d1b365969 to your computer and use it in GitHub Desktop.
@Component({
selector: 'accessing-template-reference',
template: `
<div>
<input type="text" #userName />
<input type="text" #userAge />
<input type="text" #userDesignation />
</div>
`
})
export class HeroListComponent implements OnInit {
@ViewChildren("userName, userAge, userDesignation") userInfoReference: QueryList<NgModel>;
ngAfterViewInit(): void {
console.log("Element List: " + this.userInfoReference.length);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment