I have following markup
-
[style.background-color]="activity.status == 'Pending' ? 'red' : 'green'"
or
[ngStyle]="{'backgroundColor': activity.status == 'Pending' ? 'red' : 'green' }"
For your rendering result see also In RC.1 some styles can't be added using binding syntax
讨论(0)
-
bind-
prefix alternative can be used also as below
bind-style.background-color="activity.status == 'Pending' ? 'red' : 'green'"
讨论(0)
- 热议问题