Iterating collections in Angular templates

To iterate items in a collection in templates, use the *ngFor directive in conjunction with the *ngIf directive as below:

<ul *ngIf="errors && errors.length">
	<li *ngFor="let error of errors">{{error}}</li>
</ul>

The *ngIf directive is first used to determine if the dom block should be rendered at all. Next the *ngFor directive is used to iterate over the collection.