How to bind background-image to typescript side

Hi , I am following joshmorony news feed design with parallax header https://www.joshmorony.com/create-a-stylish-news-feed-layout-in-ionic-2/
…and I was wondering of a way to bind the background image in the parallax header so its interchangable, is it possible to do that ?.. Currently it is set in sass like this:

.header-image {
  background-image: url(../assets/images/imageForHome.jpg);
  height: 40vh;
}

Yep. I think these would work:

Using style.property binding:

<div [style.backgroundImage]="myImage">...

Using ngStyle binding

<div [ngStyle]="{'background-image' : myImage}">...
1 Like