Difference between [ngClass] vs [class] binding

前端 未结 4 2171
谎友^
谎友^ 2020-11-27 17:12

What is the difference in Angular 2 between the following snippets:

4条回答
  •  日久生厌
    2020-11-27 17:31

    Using [ngClass] you're able to apply multiple classes in a really convenient way. You can even apply a function that will return an object of classes. [class. makes you able to apply only one class (of course you can use class. a few times but it looks really bad).

提交回复
热议问题