Angular: conditional class with *ngClass

后端 未结 19 2394
醉话见心
醉话见心 2020-11-22 05:21

What is wrong with my Angular code? I am getting:

Cannot read property \'remove\' of undefined at BrowserDomAdapter.removeClass ...

19条回答
  •  我在风中等你
    2020-11-22 05:49

    [ngClass]=... instead of *ngClass.

    * is only for the shorthand syntax for structural directives where you can for example use

    {{item}}

    instead of the longer equivalent version

    
    

    See also https://angular.io/docs/ts/latest/api/common/index/NgClass-directive.html

    ...
    ...
    ...
    ...
    ...
    

    See also https://angular.io/docs/ts/latest/guide/template-syntax.html

    
    
    The class binding is special
    This one is not so special
    
    
    Bad curly

提交回复
热议问题