问题-我试图在artist.images.url中对Json图像进行插值,但是得到了一个错误。
Error - NG5002:解析器错误:缺少预期:['url(‘+ {{artist.images.url}} + ') no-repeat center center']中的第32列
图像url有效,但在插入时不起作用
作品
<mat-card
[style.background]="'url(' + 'https://i.scdn.co/image/a402db0dbd2b33ca7141ea0fd31e4b81e178c39a' + ') no-repeat center center'"
[style.background-size]="'cover'" [style.height]="'450px'">
</mat-card>不工作
<mat-card
[style.background]="'url(' + {{artist.images[0].url}} + ') no-repeat center center'"
[style.background-size]="'cover'" [style.height]="'450px'">
</mat-card>发布于 2021-03-13 06:49:48
你已经在做绑定了。
<mat-card
[style.background]="'url(' + artist.images[0].url + ') no-repeat center center'"
[style.background-size]="'cover'" [style.height]="'450px'">
</mat-card>https://stackoverflow.com/questions/66608218
复制相似问题