1.

Explain Ngfor Directive With An Example?

Answer»

The ngFor DIRECTIVE instantiates a TEMPLATE for EVERY element of the given iterator. The different local variables of the ngFor directive can be used in iterations. The ngFor directive can even be used with the HTML elements. It ALSO performs various changes in DOM. Several exported values can be aliased to local variables with the help of ngFor directive. It allows us to build data presentation lists and tables in our HTML TEMPLATES.

Here’s an example of ngFor directive with the help of HTML:

<tr *ngFor=”hero of heroes”>

<td>({hero.name})</td></tr>

The ngFor directive instantiates a template for every element of the given iterator. The different local variables of the ngFor directive can be used in iterations. The ngFor directive can even be used with the HTML elements. It also performs various changes in DOM. Several exported values can be aliased to local variables with the help of ngFor directive. It allows us to build data presentation lists and tables in our HTML templates.

Here’s an example of ngFor directive with the help of HTML:

<tr *ngFor=”hero of heroes”>

<td>({hero.name})</td></tr>



Discussion

No Comment Found