Angular for Directive

Declare for array in ts file

public colors =['red','blue','green','black','yellow'];

 

In html file

<ul>

    <li *ngFor="let color of colors">{{color}}</li>

</ul>

 

 

Angular for Directive    

{{color}}

// Loop

Serial Number Show (index as i)

 

 

    

 

 

    • {{color}}

       

    • index
    • first
    • last
    • even
    • odd