首页 > 解决方案 > 角度cli中找不到图像错误

问题描述

当我使用角度快速入门时,图像可以在网络浏览器上打印,但现在我使用的是角度 cli,图像无法打印。我使用相同的标签相同的代码来打印图像。我已经尽力了。所有依赖项都已安装。这有什么问题有人可以帮我解决这个问题吗?

angular-cli 版本是 6.0.5,$ node -v 版本是 v10.2.0,$ npm -v 版本是 6.0.1

在 app.component.ts 中,

export class AppComponent  { 
 appList: any[] = [ {
 "ID": "1",
 "url": 'app/images/1.jpg',
 "height": "30",
 "width":"40",
 "align":'left' }];}

在 app.component.html 中,

<div *ngFor = 'let lst of appList'>
<ul>
   <li>{{lst.ID}}</li>
   <img [src] = 'lst.url' [height] ='lst.height' [width] ='lst.width' [align] = 'lst.align' >
</ul>

标签: htmlimagehtml-lists

解决方案


推荐阅读