Search
 
SCRIPT & CODE EXAMPLE
 

JAVASCRIPT

viewchild for ngfor

<div *ngFor="let v of views">
    <customcomponent #cmp></customcomponent>
</div>

-------------------------

import { ViewChildren, QueryList } from '@angular/core';

/** Get handle on cmp tags in the template */
@ViewChildren('cmp') components:QueryList<CustomComponent>; // or ElementRef if only need to grab element

ngAfterViewInit(){
    // print array of CustomComponent objects
    console.log(this.components.toArray());
}
Comment

PREVIOUS NEXT
Code Example
Javascript :: how to stop browser back js 
Javascript :: toggle class javascript stack overflow 
Javascript :: return only specific attributes when making query mongoose 
Javascript :: Rename files in a directory with node.js 
Javascript :: While loop factorial function in javascript 
Javascript :: getelementsbyclassname remove class 
Javascript :: convert node.js to ES6 
Javascript :: how to convert entered number into currency in words in javascript 
Javascript :: js onchange input value event listene 
Javascript :: lodash remove element from array 
Javascript :: what 1hr in milliseconds in javascript 
Javascript :: dinosaur game hacks 
Javascript :: jest writing test 
Javascript :: install node on ubuntu and debian 
Javascript :: momentjs range 
Javascript :: parse csv javascript 
Javascript :: javascript map max value 
Javascript :: generate component react 
Javascript :: javascript absolute path 
Javascript :: how to add oAuth google signin in react native app 
Javascript :: javascript run command 
Javascript :: what are native node modules 
Javascript :: substring javascript 
Javascript :: how to create a form without a submit button javascript 
Javascript :: remove # from url javascript 
Javascript :: What is data modeling in MongoDB 
Javascript :: count number of word in javascript 
Javascript :: how to use Space for vertically in antd 
Javascript :: date time js 
Javascript :: authfunctions express 
ADD CONTENT
Topic
Content
Source link
Name
6+6 =