Complex angular js ng-class

后端 未结 5 1441
暗喜
暗喜 2020-12-23 16:40

I have the component and have a problem setting the css class to it. I want it to always have a class of \"box\", then to have additional classes specified by the directive

5条回答
  •  予麋鹿
    予麋鹿 (楼主)
    2020-12-23 17:18

    A quick solution would be define the box class inside ng-class attribute:

    If you want to include a scope variable as a class, you can't use ng-class:

    Angular expressions do not support the ternary operator, but it can be emulated like this:

    condition && (answer if true) || (answer if false)

提交回复
热议问题