0

Why do I get the error below for the below template code on the first curly bracket. It still seems to work fine.

property value expectedcss(css-propertyvalueexpected)

<div class="error-loading" style="color: {{tenant?.style.pageColorCardPage ? tenant?.style.pageColorCardPage : tenant?.style.pageColor}};">
MadMac
  • 4,048
  • 6
  • 32
  • 69
  • See if this helps: https://stackoverflow.com/questions/57352156/error-property-value-expected-css-and-at-rule-or-selector-expected-css-editi – Sujit Singh Oct 13 '21 at 01:32
  • @SujitSingh Yes that is it thanks. https://stackoverflow.com/a/57495678/10222449 – MadMac Oct 13 '21 at 20:01

1 Answers1

0

Because the css is invalid until the code is executed, at which point it becomes valid and displays correctly.

The way I have got around this is when setting a style on a row

in the template..

<tr *ngFor='let row of reportData$' [style]="getRowStyle(row)">

and in the component you can get as creative as you like...

getRowStyle(row: any){
  return "border: "+row.border_weight+"px solid black;";
}