2017-09-26 22 views
2

メインページにIonic3アプリケーションとイオンスライドコンポーネントがあります。イオン3 - イオンスライドインラインCSS

<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> 

私はスタイル

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

を使用して、インラインCSSの背景画像を追加したいがblog.image内部を渡すことはできません。これを行う方法?すなわち、結合プロパティとしてbackgroundImageを使用

を:以下に示すように

答えて

3

あなたは試すことができます

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

{{}} blog.imageないここに動作します。 –

+1

私は答えを編集しました。あなたは今@GochaGochitashviliを試してみることができますか? – sebaferreras

+2

はい、うまくいきます!ありがとう。 –