How to use ngFor in a tag? 

The ngFor directive is used to build lists and tables in the HTML templates. In simple terms, this directive is used to iterate over an array or an object and create a template for each element. 

<ul> 

      <li *ngFor = “let items in itemlist”> {{ item }} </li>

    </ul>

  1. “Let item” creates a local variable that will be available in the template
  2. “Of items” indicates that we are iterating over the items iterable. 
  3. The * before ngFor creates a parent template. 

Comments

Leave a Reply

Your email address will not be published. Required fields are marked *