Я пытаюсь установить динамические цвета для background-color
и color
для ion-button
(Framework v4.0.0).Чего я достиг на данный момент:
![enter image description here](https://i.stack.imgur.com/iOMuZ.png)
Моя проблема: Цвет кнопки перекрывает контур кнопки.Является ли это проблемой Ionic, как я могу обойти это?
Шаблон:
<ion-button *ngFor="let d of districts" shape="round"
(click)="districtClicked(d)"
[ngStyle]="getDistrictStyle(d)"
color="{{getDistrictColors(d)[0]}}">
{{getDistrictName(d)}}
</ion-button>
Метод в моем компоненте:
getDistrictStyle(district: District) {
if (district) {
const colors = this.colorGenerator.getDistrictColors(district);
return {
'background-color': colors[0],
'color': colors[1]
};
}
}
getDistrictColors(district: District)
просто возвращает массив с двумя цветами в шестнадцатеричном виде (красный и белый в данном случае).