How to bind background-image to typescript side

Hi , I am following joshmorony news feed design with parallax header
…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 binding:

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

Using ngStyle binding

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