Answer the question
In order to leave comments, you need to log in
Angular5, why is the function called 2 times in ngClass?
I am mastering Angular and do not yet understand all the features and subtleties.
In particular, this example:
there is a regular component (let's say I have a list item) and it has a method that returns an array of css classes:
cssGetClasses() {
console.log('call cssGetClasses');
let css = [];
// здесь идут какие-то условия и css заполняется исходя из них
if (true) {
css.push('ok');
} else {
css.push('err');
}
return css;
}
<li [ngClass]="cssGetClasses()"></li>
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question