Swap css for parameter

Asked

Viewed 54 times

-3

Angular Version: 8.2

Hello,

I’m trying to change the CSS every time I change a parameter (company). Each company has its theme, for example, company A the theme is red, so in certain parts of the view will be red, already in company B the theme is green...

I tried to create a property:

cssEstilos: { [key: string]: string } = {};

And in my builder:

cssEstilos = {
    background-color = "red"
}

In HTML:

<nav [ngStyle]="cssEstilos"> ...

When I run the application, it doesn’t work and then I open the inspect element and inside the ngStyle I have:

ng-reflect-ng-style="[object Object]"

1 answer

0


change to:

cssEstilos = {     
   'background-color': 'red',  
};

Browser other questions tagged

You are not signed in. Login or sign up in order to post.