-1

Angular provides a replacement binding syntax as follows :

[class]="badCurly"

Does it mean the class is set to string "badCurly" or the class is set to value resolved from badCurly property belonging to component ?

This is different from attribute binding as it doesn't use the . syntax. Its specifically about class binding.

The accepted answer solved the query and answers that this will be resolved from component.

user2599052
  • 1,056
  • 3
  • 12
  • 27
  • Possible duplicate of [Property binding vs attribute interpolation](https://stackoverflow.com/questions/39112904/property-binding-vs-attribute-interpolation) – Harun Yilmaz Feb 08 '19 at 09:40
  • @HarunYılmaz this addresses different issue. – user2599052 Feb 08 '19 at 09:44
  • No it doesn't. And also you may find this helpful: https://stackoverflow.com/questions/45321526/difference-between-ngclass-vs-class-binding – Harun Yilmaz Feb 08 '19 at 09:48
  • @HarunYılmaz it is unfortunate that you dont understand the question. cant help.. – user2599052 Feb 08 '19 at 09:50
  • I completely understand the question. It is attribute/property binding of Angular and is not different for `class`. Besides, Angular provides extra `ngClass`, `class.xxx` binding syntax. Therefore, the two links I provided should work well for you. – Harun Yilmaz Feb 08 '19 at 09:57
  • My question is not about ngClass, class.xxx as you are thinking. It is about just [class]. Anways , Nithin P.H has understood it and answered it. Dont worry. Thanks for downvoting as well. – user2599052 Feb 08 '19 at 10:05

1 Answers1

1

[class]="badCurly" In your ts file what ever the value of the object badCurly is that will be the value of the class

here is an example in stackblitz

Nithin P.H
  • 671
  • 1
  • 9
  • 29