I have a div that I want to style based on a condition.
If styleOne is true I want a background colour of red. If StyleTwo is true, I want the background colour to be blu
For a single style attribute, you can use the following syntax:
I assumed that the background color should not be set if neither style1 nor style2 is true. Since the question title mentions ngStyle, here is the equivalent syntax with that directive: 0 讨论(0) 查看其它4个回答 发布评论: 提交评论 加载中... 验证码 看不清? 提交回复
I assumed that the background color should not be set if neither style1 nor style2 is true.
style1
style2
true
Since the question title mentions ngStyle, here is the equivalent syntax with that directive:
ngStyle
0 讨论(0) 查看其它4个回答 发布评论: 提交评论 加载中... 验证码 看不清? 提交回复