Angular10 NgFor Directive Last Updated : 06 Jan, 2023 Summarize Comments Improve Suggest changes Share Like Article Like Report In this article, we are going to see what is NgFor in Angular 10 and how to use it. NgFor is used as a structural directive that renders each element for the given collection each element can be displayed on the page. Syntax: <li *ngFor='condition'></li> NgModule: Module used by NgForOf is: CommonModule Selectors: [ngFor] Approach: Create the angular app to be usedThere is no need for any import for the NgFor to be usedIn app.component.ts define the array to be used with ngFor directive.In app.component.html use NgFor directive with list element to display array elements.serve the angular app using ng serve to see the output Example 1: app.component.ts import { Component } from '@angular/core'; @Component({ selector: 'app-root', templateUrl: './app.component.html', }) export class AppComponent { a=['gfg1', 'gfg2', 'gfg3', 'gfg4'] } app.component.html <ul> <li *ngFor='let i of a'> {{i}} </li> </ul> Output: Example 2: app.component.ts import { Component } from '@angular/core'; @Component({ selector: 'app-root', templateUrl: './app.component.html', }) export class AppComponent { a=['gfg1', 'gfg2', 'gfg3', 'gfg4'] } app.component.html <ol> <li *ngFor='let i of a'> {{i}} </li> </ol> Output: Reference: https://angular.io/api/common/NgForOf Comment More infoAdvertise with us Next Article Angular10 NgFor Directive T taran910 Follow Improve Article Tags : Web Technologies AngularJS AngularJS-Directives Angular10 Similar Reads Angular 10 NgIf Directive In this article, we are going to see what is NgIf in Angular 10 and how to use it. The ngIf Directive in Angular10 is used to remove or recreate a portion of HTML element based on an expression. If the expression inside it is false then the element is removed and if it is true then the element is ad 2 min read Angular forms NgForm Directive In this article, we are going to see what is NgForm in Angular 10 and how to use it. NgForm is used to create a top-level form group Instance, and it binds the form to the given form value. Syntax: <form #FormName = "ngForm"> </form> NgModule: Module used by NgForm is: FormsModule Select 1 min read Angular10 NgSwitch Directive In this article, we are going to see what is NgSwitch in Angular 10 and how to use it. The NgSwitch in Angular10 is used to specify the condition to show or hide the child elements. Syntax: <li *NgSwitch='condition'></li> NgModule: Module used by NgSwitch is: CommonModule  Selectors: [N 1 min read AngularJS ng-src Directive The ng-src Directive in AngularJS is used to specify the src attribute of an <img> element, ie., it overrides the original src attribute for an <img> element. This attribute must be used if we have the Angular code inside of the src element. It ensures that the wrong image is not produce 2 min read AngularJS ng-show Directive The ng-show Directive in AngluarJS is used to show or hide the specified HTML element. If the given expression in the ng-show attribute is true then the HTML element will display otherwise it hides the HTML element. It is supported by all HTML elements. Syntax: <element ng-show="expression"> C 2 min read Like