Angular · Junior · Question 14 of 75

How do you toggle a CSS class depending on a condition?

Explanation

Class binding adds or removes one class. For several classes there is [class]="{ active: isActive, disabled: isDisabled }", and for styles [style.width.px]="width".

Further reading

Problem with a question

Angular · Junior · question 14

Test yourself

Take the Angular · Junior quiz: questions and options are shuffled, and you get a review of your mistakes at the end.

Take this quiz