I'm working with a Angular Material toolbar which can have three types of color: 'primary', 'accent', or 'warn'.
The color of a can be changed by using the color property. By default, toolbars use a neutral background color based on the current theme (light or dark). This can be changed to 'primary', 'accent', or 'warn'.
I want to change this color to "warn" if a specific condition exists. I've already tried the following things:
<md-toolbar color="warn">
Shows the warning color correctly.
<md-toolbar color="{{true ? 'warn' : null}}">
Shows the toolbar as if no color would have been set
<md-toolbar [attr.color]="true ? 'warn' : null">
Shows the toolbar as if no color would have been set
How am I supposed to set this?
The color of a <mat-toolbar> can be changed by using the color property. By default, toolbars use a neutral background color based on the current theme (light or dark). This can be changed to 'primary' , 'accent' , or 'warn' .
The <mat-toolbar> is an Angular Directive used to create a toolbar to show the title, header, or any button action of buttons.
You have to use attribute binding:
<md-toolbar [color]="true ? 'warn' : null">
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With