Reader small image

You're reading from  Expert Angular

Product typeBook
Published inJul 2017
Reading LevelExpert
PublisherPackt
ISBN-139781785880230
Edition1st Edition
Languages
Right arrow
Author (1)
Sridhar Rao Chivukula
Sridhar Rao Chivukula
author image
Sridhar Rao Chivukula

Sridhar Rao Chivukula is a technical lead at Mindtree Ltd and is based out of New York City. He brings with him more than a decade of rich hands-on experience in all aspects of frontend engineering. He has worked with leading companies such as Oracle, Tech Mahindra, and Cognizant Technology Solutions. He has a Bachelor's degree in Information Technology. He is the author of the books Expert Angular and PHP and Web 2.0 Application Interfaces, published by Packt.
Read more about Sridhar Rao Chivukula

Right arrow

Structural Directives

As the name mentions, Structural Directives alter the DOM structure by adding, appending, or removing DOM elements on the fly.

Angular Structural Directives are displayed with an (*) asterisk symbol before the directive name.

Some of the commonly used Structural Directives are as follows:

  • ngFor: Repeater directive generally used to loop through and display a list of elements.
  • ngIf: Shows or hides DOM elements depending on the result of expression evaluation; the result is either true or false.
  • ngSwitch: Returns if the match expression value matches the value of the switch expression. The result returned can be any value; a conditional check is done for matching values.
Only one Structural Directive is allowed per element.

Let's learn about each of these Structural Directives in detail and create few examples using them:

...
lock icon
The rest of the page is locked
Previous PageNext Page
You have been reading a chapter from
Expert Angular
Published in: Jul 2017Publisher: PacktISBN-13: 9781785880230

Author (1)

author image
Sridhar Rao Chivukula

Sridhar Rao Chivukula is a technical lead at Mindtree Ltd and is based out of New York City. He brings with him more than a decade of rich hands-on experience in all aspects of frontend engineering. He has worked with leading companies such as Oracle, Tech Mahindra, and Cognizant Technology Solutions. He has a Bachelor's degree in Information Technology. He is the author of the books Expert Angular and PHP and Web 2.0 Application Interfaces, published by Packt.
Read more about Sridhar Rao Chivukula