I\'m trying to apply a background image to a div by using the angular ng-style
( I tried a custom directive before with the same behaviour ), but it doesn\'t se
It is possible to parse dynamic values in a couple of way.
Interpolation with double-curly braces:
ng-style="{'background-image':'url({{myBackgroundUrl}})'}"
String concatenation:
ng-style="{'background-image': 'url(' + myBackgroundUrl + ')'}"
ES6 template literals:
ng-style="{'background-image': `url(${myBackgroundUrl})`}"
The syntax is changed for Angular 2 and above:
[ngStyle]="{'background-image': 'url(path)'}"