How to change ion-item-divider color dynamically?


#1

I’ve tried to use
<ion-item-divider [color]="data.color"> or
<ion-item-divider [ngClass]="data.color">
but not work.


#2
<ion-item-divider [style.background]="data.color">

#3

<ion-item-divider [style.background]="data.color">
Still not work for me
<ion-item-divider [style.background]="'light'">


#4

Still you use the code without logic. I can’t help you, you must start to read documentation. Sorry


#5

I’ve found the value of style.background must be set to color codes! thanks!

this.data.color = '#CC6699'
<ion-item-divider [style.background]="data.color">

or
<ion-item-divider [ngStyle]="{'background-color':data.color}">