How to Add & Remove CSS Classes dynamically in Angular?
3 Answers
Know the answer? Post it. Somebody with the same question will find it here.
Know the answer? Post it. Somebody with the same question will find it here.
Answer a question in the forums and earn +20 SHARP for every answer.
See unanswered questions
DevSocialUpcoming · 3rd editionAI Agents ConferenceDec 1–3, 2026Live onlineFree to attend5days leftRegister
Bhairab DuttRank #799 · 2.9K reputationPosted May 26, 2018, 9:02 AM EDT
You can use Class Binding as:
app.component.html
"color:blue"
>Class BindingYou can use [ngClass] Directive .
If you want to read about more binding in Angular 4 , You can read my Article :
https://www.c-sharpcorner.com/article/learn-binding-in-angular/
Hope Its help you.
Thanks.
Bhairab DuttRank #799 · 2.9K reputationPosted May 26, 2018, 10:51 AM EDT
Sanjit Kumar SinghRank #1,366 · 1.2K reputationPosted May 26, 2018, 10:17 AM EDT