How to change div background image in ionic

154 Views Asked by At
<div class="col m-2 image row"
    *ngFor="let aa of activiteAvenir" [ngStyle]="{'background-image':url(' +aa.image+ ')}"
     style=" background-repeat: no-repeat;   background-position: center; background- 
     size: cover; border-radius: 10px;">

</div>

I tried a lot of things that didn't work I really don't need it; urgently; In some cases the ng style was giving me [object object]

1

There are 1 best solutions below

7
Md. Delowar Hossen On

Please try this

<div class="col m-2 image row"
    *ngFor="let aa of activiteAvenir" [ngStyle]="{'background-image':'url('+ aa.image +')'}"
     style=" background-repeat: no-repeat;   background-position: center; background- 
     size: cover; border-radius: 10px;">

</div>