1

I have an HTML element with the style attribute for inline CSS.

<div style="border-color:aqua!important">
...
</div>

I want to be able to pass values such that "aqua" would be changed via Angular 2 interpolation so I tried this...

<div style="border-color:{{item.color}}!important">
...
</div>

But this isn't working

2
  • Try using [style]="border-color: item.color !important" Commented Jan 22, 2017 at 12:07
  • Nope. Isn't working Commented Jan 22, 2017 at 12:13

1 Answer 1

1

Try using

<div [style.border-color]="item.color">..</div>
Sign up to request clarification or add additional context in comments.

2 Comments

I tried without the "!important" and value is getting passed when I inspect but I need the "!important" to override cascading
Rewrote CSS so !important wasn't neccessary. Thank you very much

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.