Reputation: 1111
When i try to style my md-chips with the color attribute nothing happens. According to the guide https://material.angular.io/components/component/chips this has to work. All my other elements style without problems.
<md-chip-list>
<md-chip color="primary"> Chicken </md-chip>
<md-chip color="warn"> Table </md-chip>
<md-chip color="accent"> Tree </md-chip>
<md-chip> Eight </md-chip>
</md-chip-list>
Does anybody know how to fix this?
Thanks in advance!
Upvotes: 13
Views: 8119
Reputation: 2393
You can set the md-chip color dynamically by using ngStyle
<md-chip-list>
<md-chip *ngFor="let item of itemList" [ngStyle]="{ backgroundColor: item.color }">
{{ item.name }}
</md-chip>
</md-chip-list>
Upvotes: 7
Reputation: 1097
Right now (24 Sep 2017), this is not working. Even on the example in the docs isn't working
I was forced to use a CSS property:
<md-chip color="primary" [selected]="true" style="background-color: #986f37">Content here</md-chip>
Upvotes: 3
Reputation: 1023
According to the plunkr example, the chips are only colored when the selected
attribute is set to true
:
<md-chip color="accent" selected="true">Chicken</md-chip>
Upvotes: 29