Sangwin GawandeIgnat提出了一个问题:How to add background-image using ngStyle (angular2)?,或许与您遇到的问题类似。
回答者Thierry Templier给出了该问题的处理方式:
I think you could try this:
<div [ngStyle]="{'background-image': 'url(' + photo + ')'}"></div>
From reading your ngStyle
expression, I guess that you missed some "'"...
希望本文对你有帮助,欢迎支持JavaScript中文网