【问题标题】:Angular4 background image [duplicate]Angular4背景图片[重复]
【发布时间】:2018-04-26 15:55:20
【问题描述】:

我正在尝试为 div 制作背景图片。但图像未显示。这是我的代码。

<div [ngStyle]="{'background-image' : imageresult.pictureUrl}"> some content here! </div>

【问题讨论】:

  • 它在您的网络浏览器的控制台中显示什么?你有错误吗?路径是否正确?

标签: angular image background-image


【解决方案1】:

试试这个并确保你已经在 angular-cli.json 中添加了你的资产

[ngStyle]="{'background-image': 'url(' + imageresult.pictureUrl+ ')'}"

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2015-03-14
    • 2011-06-29
    • 1970-01-01
    • 2012-08-21
    • 1970-01-01
    • 2013-08-16
    • 1970-01-01
    • 2018-11-07
    相关资源
    最近更新 更多