Quantcast
Channel: Ionic Forum - Latest topics
Viewing all articles
Browse latest Browse all 70440

Ionic toolbar dynamically change background image

$
0
0

@lenart wrote:

Hi,

I have problem whit adding a background image dynamically to toolbar.
I try whit:

HTML
 <ion-toolbar  [ngStyle]="mainBackground" [ngClass]="color == 53 ? 'pet' : 'not-pet'" class="single-header-bg">

TS:
  this.mainBackground: {
                    background: 'url(' image/url ')',
}

This returns


but i need to get --background, i try to insert in to TS --background but then it doesn’t appear at all.

2.

HTML 
<ion-toolbar  [style.background]="bgImage" [ngClass]="color == 53 ? 'pet' : 'not-pet'" class="single-header-bg">

TS
 this.bgImage = 'url(' image/url ')',

This doesn’t return nothing, i just see on web some one make this work for a background-color.

Thank you for your help :wink:

Posts: 1

Participants: 1

Read full topic


Viewing all articles
Browse latest Browse all 70440

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>