Attribute property binding for background-image url in Angular 2
I think that you should use something like that:
<div class="profile-image"
[ngStyle]="{ 'background-image': 'url(' + image + ')'}">
where image
is a property of your component.
See this question:
- How to add background-image using ngStyle (angular2)?
You don't need to use NgStyle
. You can also do this:
[style.background-image]="'url(' + image + ')'"
See more at How to add background-image using ngStyle (angular2)?