Skip to main content

Posts

Showing posts with the label Angular 5 NgForOf and ngFor loops with Example

Angular 5 and 4 NgForOf and ngFor loops with Example

The NgForOf/ NgFor directive instantiates a template once per item from an iterable and the context for each instantiated template inherits from the outer context with the given loop variable set to the current item from the iterable. The Selectors - ü   [ngFor] ü   [ngForOf] Stayed Informed – Angular 5 and Angular 4 Documents NgForOf with HTML Elements - The NgForOf directive is used with HTML elements as following. < h2 > User List - NgForOf and NgFor loops </ h2 > < div >   < ul * ngFor = "let user of users | index as i" >     < li >          {{i}} - {{user}}          </ li >   </ ul > </ div > NgForOf with <ng-template> - The NgForOf directive is used with <ng-template> as following. < h2 > User List - NgForOf and NgFor loops </ h2 > < div > ...