17.10.2018 Views

Angular

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

Chapter 44: How to Use ngif<br />

*NgIf: It removes or recreates a part of DOM tree depending on an expression evaluation. It is a structural directive<br />

and structural directives alter the layout of the DOM by adding, replacing and removing its elements.<br />

Section 44.1: To run a function at the start or end of *ngFor<br />

loop Using *ngIf<br />

NgFor provides Some values that can be aliased to local variables<br />

index -(variable) position of the current item in the iterable starting at 0<br />

first -(boolean) true if the current item is the first item in the iterable<br />

last -(boolean) true if the current item is the last item in the iterable<br />

even -(boolean) true if the current index is an even number<br />

odd -(boolean) true if the current index is an odd number<br />

<br />

{{i}}

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!