ngClass in host property of component decorator does not work

后端 未结 3 1228
佛祖请我去吃肉
佛祖请我去吃肉 2021-02-07 17:44

I created the following simple example component that adds some attributes and listener to the component DOM element using the host property of the @Component decorator. In my c

3条回答
  •  隐瞒了意图╮
    2021-02-07 18:08

    ngClass is a directive and can't be used in host bindings. Host bindings only supports

    • property '[propName]':'expr'
    • attribute '[attr.attrName]':'expr'
    • event (event)="someFunction(event);otherExpr",
    • style [style.width]="booleanExpr"
    • class [class.className]="booleanExpr" binding.
    • class [class]="expr" where expr is a string with space separated classes

提交回复
热议问题