I am trying to combine an expression + a function in an ngClass, however the expression is not being evaluated and the class is not executed, currently I have it like this, it is just an example:
<div [ngClass]="[cargar(), {'hola':true}]"></div>
cargar() {
return 'hola2';
}
so it is only applying the class that brings load(), and hello it is not being applied even knowing that I evaluate it as true
here the example
From what I see in the official angular documentation, in the ngClass attribute, only expressions can be placed. you can place string, arrays or objects. therefore a function is not well received.
I do not see that it allows combining both ways as you do, I have tried to execute it and it does not allow it, you must do it in one way or another.
I leave you the link of the official angular documentation https://angular.io/api/common/NgClass
If what you want is to apply one class or another as you see fit, one of the ways could be as follows:
I have in my css the following classes: