![](/img/trans.png)
[英]How to display stored images in Spring Boot using Angular 4?
[英]how can I display images using a path stored in a child table- Angular and Spring boot
我正在处理一个项目,其中图像 url 存储在子表(图像)中并且图像位于文件夹中。 我可以显示图像表中的所有图像。
<ng-container matColumnDef="location">
<th mat-header-cell *matHeaderCellDef>IMAGE</th>
<td mat-cell *matCellDef="let productImage">
<img
height="100"
width="100"
src="{{ productImage?.location }}"
class="rounded-circle img-fluid img-thumbnail"
alt=""
/>
</td>
但是当我尝试以下操作时,图像不会显示,而其他数据可以通过父子关系访问。 这个product.image.name
工作正常。
<ng-container matColumnDef="location">
<th mat-header-cell *matHeaderCellDef>Image</th>
<td mat-cell *matCellDef="let product">
<img
height="100"
width="100"
src="{{ product.image.location }}"
alt="{{ product.image.name }}"
class="rounded-circle img-fluid img-thumbnail"
alt=""
/>
</td>
</ng-container>
为了显示图像,我添加了image.setLocation(entity.getImage().getLocation());
在我的产品 dto 转换器中。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.