October 17, 2016

Angular 2 use ngSwitch ngIf ngFor without additional DOM Element

Probably you want as little DOM elements as possible. You can use a ng-container instead of a regular HTML element in order to receive reduced markup.

Example of ngSwitch:

Example for *ngIf:

 

Related Posts

Avatar photo

theCodeCampus
Developer at thecodecampus </>

Our knowledge is not simply gained through reading - it is trained, tested and constantly being expanded. Because first and foremost, we are all developers at W11K. The know-how that we acquire here as developers, consultants and information architects flows immediately into our training courses and articles for theCodeCampus.


Leave a Reply

Add code to your comment in Markdown syntax.
Like this:
`inline example`

```
code block
example
```

Your email address will not be published.