Skip to content Skip to sidebar Skip to footer

Angular 2. What Is Faster To Render: [ngClass] Or Class="{{}}"?

What will render faster?
one
or
another
o

Solution 1:

I did some research and can surely say that this approach

<div class="ololo" [ngClass]="{'my-class': myVar}">one</div>

works about 3 times slower than

<div class="ololo {{myVar ? 'my-class': ''}}">another</div>

please see a demo

https://stackblitz.com/edit/angular-fvtzck


Post a Comment for "Angular 2. What Is Faster To Render: [ngClass] Or Class="{{}}"?"