O'Reilly logo

Learning Angular for .NET Developers by Rajesh Gunasundaram

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Structural directives

Structural directives deal with modifying elements in the DOM by adding new elements, removing existing elements, and replacing existing elements with new elements. The following markup shows two structural directives: *ngFor and *ngIf:

<div *ngFor="#todo of todos"></div> <todo-item *ngIf="selectedTodo"></todo-item> 

*ngFor iterates through each item in the todos collection and adds a div tag for each item. And *ngIf renders <todo-item> only if selectedTodo is available.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required