0

I have this tables , and I need to apply color in header , but where used ngStyle & !important now working ,

 <div ng-app='my.app'>
                <table>
              <tr>
                <th ng-style="{'background-color': 'blue !important'}">Column 1</th>
                <th style="background-color: blue !important;">Column </th>
                <th style="background-color: blue !important;">Column </th>
                <th style="background-color: blue !important;">Column </th>
                <th style="background-color: blue !important;">Column </th>
              </tr>
              <tr>
                <td>1</td>
                <td>1</td>
                <td>1</td>
                <td>1</td>
                <td>1</td>
        
              </tr>
              
              <tr>
                <td>11</td>
                <td>11</td>
                <td>11</td>
                <td>11</td>
                <td>11</td>
        
              </tr>
              
              <tr>
                <td>111</td>
                <td>111</td>
                <td>111</td>
                <td>111</td>
                <td>111</td>
        
              </tr>
              
              <tr>
                <td>1111</td>
                <td>1111</td>
                <td>1111</td>
                <td>1111</td>
                <td>1111</td>
        
              </tr>
            </table>
        </div>

in above table is apply style header in 4 column using below line

style="background-color: blue !important;"

but the first column when used below line not working

ng-style="{'background-color': 'blue !important'}"

I try this lines to solved this issue but not working :

- [attr.style]="'background-color:red !important'"
      not show erro but not working 

- ng-attr-style="{{'background-color: pink!important'}}   

   
      return this error : Can't bind to 'ng-attr-style' since it isn't a known property of 'th'. 
      ("pSortableColumn]="header.columnName"

- data-ng-attr-style="{{ blue && 'background-color: blue!important' || '' }}"

can have any idea to solved this issue , thanks for all

R. Richards
  • 24,603
  • 10
  • 64
  • 64

0 Answers0