What is the difference when computing class using ngClass and directly computing class using the HTML class attribute in Angular 4.
[ngClass]="computeClass()"
and
class="{{computeClass()}}"
computeClass() {
if (condition) {
return 'class-a';
} else {
return 'class-b';
}
}
Both returns the same result. How does this impact on the performance?
Edit: My question is different from the question marked as duplicate as it compares [ngClass] and [class] whereas, the above comparison is between [ngClass] and class.