Ionic 3 - ion-slide inline css

Viewed 798

I have Ionic3 App and ion-slides component on main page.

<ion-slides pager>
    <ion-slide *ngFor="let blog of blogs | async" >
      <h2>{{ blog.title }}</h2>
      <p>
      <a target="_blank" class="slider-read-more" ion-button outline color="secondary" (click)="blogDetail(blog)">ვრცლად</a>
      </p>
    </ion-slide>
  </ion-slides>

I want to add inline css background image using style

<ion-slide *ngFor="let blog of blogs | async" style="background:url(blog.image) no-repeat center center fixed;">

but can't pass blog.image inside. how to do this?

2 Answers

You can try as shown below:

i.e. use backgroundImage as a property binding:

 <ion-slide [style.backgroundImage]="'url(' + blog.image + ')'"> ...
Related