Skip to content

Instantly share code, notes, and snippets.

@Mayankgupta688
Last active March 13, 2021 19:32
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/e75b17c94b7fa34486913a353a451cb9 to your computer and use it in GitHub Desktop.
Save Mayankgupta688/e75b17c94b7fa34486913a353a451cb9 to your computer and use it in GitHub Desktop.
@Component({
selector: 'accessing-template-reference',
template: `
<div>
<user-details [userId]="firstUser"></user-details>
<user-details [userId]="secondUser"></user-details>
<user-details [userId]="thirdUser"></user-details>
</div>
`
})
export class HeroListComponent implements OnInit {
@ViewChildren("UserDetailComponent") userDetailReferences: QueryList<NgModel>;
ngAfterViewInit(): void {
console.log("Element List: " + this.userDetailReferences.length);
}
}
@Mohamed-Abuelatta
Copy link

Mohamed-Abuelatta commented Mar 13, 2021

Thank you, it's great for an absolute beginner like me.

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