I thought this was pretty easy, but i don't have a clue of how to make it work, my last try is on the style attribute in the button tag, i've searched the web for like and hour and nothing works.
<ion-header>
<ion-navbar color="danger">
<ion-title>Cadenas</ion-title>
</ion-navbar>
</ion-header>
<ion-content container class="card-cadenasmercados">
<button id="sucursal"
*ngFor="let cadena of cadenasCollection"
[navPush]="sucursalesPage"
[navParams]="cadena"
style:background='{{cadena.img}}'>
{{cadena.nombre}}</button>
</ion-content>
You can use ngStyle: https://angular.io/api/common/NgStyle
<button id="sucursal"
*ngFor="let cadena of cadenasCollection"
[navPush]="sucursalesPage"
[navParams]="cadena"
[ngStyle]="{'background': cadena.img}">
{{cadena.nombre}}</button>
this assumes cadena.img is something like "url(someimage.png)"
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.