Skip to content

Instantly share code, notes, and snippets.

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