【发布时间】:2021-02-01 09:22:05
【问题描述】:
我尝试将从我的 api 获取的图像设置为我的标题中的背景图像。但它不会按预期工作......
这是我的代码:
<div class="container">
<div class="header" [ngStyle]="{background: 'url('userProfile.headerImagePath')'}">
...
css
.header {
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
height: 500px;
min-width: 100%;
background-color: yellowgreen;
}
【问题讨论】:
-
检查这个答案。这可能会有所帮助stackoverflow.com/questions/34875426/…