Angular4背景图片 [英] Angular4 background image
本文介绍了Angular4背景图片的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在尝试为div制作背景图片。但图像没有显示。这是我的代码。
I am trying to make a background image to div. but image not showing. here is my code.
<div [ngStyle]="{'background-image' : imageresult.pictureUrl}"> some content here! </div>
推荐答案
尝试此操作并确保已添加资产在angular-cli.json
try this and be sure that you have added your assets in angular-cli.json
[ngStyle]="{'background-image': 'url(' + imageresult.pictureUrl+ ')'}"
这篇关于Angular4背景图片的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文