I have this select in angular material:
Its code :
<md-select placeholder="Descuentos y convenios" [(ngModel)]="passenger.discount"> <md-option [value]="null" [disabled]="true"> Descuentos </md-option> <md-option *ngFor="let option of discounts" [value]="option"> {{ option }} </md-option> <md-option [value]="null" [disabled]="true"> Convenios </md-option> <md-option *ngFor="let option of agreements" [value]="option"> {{ option }} </md-option> </md-select>
And I would like to have this styles in it:
I tried to put some classes over md-select and md-option, but not worked. I would like to have maybe just an example of how to put the background color or the border and that would give me an idea.
Thank you in advance
Our solution to ViewEncapsulation was to override very specific css using highly specific css selectors in 1) global css or 2) creating separate style files for certain views / styles / elements, importing into every component required (e.g. styleUrls: [material-table-override.
If you want to override a component's styles using custom classes, you can use the className prop, available on each component.
Both APIs ::ng-deep and /deep/ are deprecated and will eventually be removed in the future.
I think classes should work, but you may need to use /deep/ because of the view encapsulation.
Try this:
/deep/ md-select.your-class { background-color: blue; }
You can also play with theming.
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