[英]how can I display images using a path stored in a child table- Angular and Spring boot
I'm working on a project where image url is stored in a child table(image) and the image is in a folder.我正在处理一个项目,其中图像 url 存储在子表(图像)中并且图像位于文件夹中。 I can display all images from image table.
我可以显示图像表中的所有图像。
<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>
But when I try the following, the images are not displayed while other data is accessible through parent–child relationship.但是当我尝试以下操作时,图像不会显示,而其他数据可以通过父子关系访问。 this
product.image.name
works okay.这个
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>
To have the images displayed I added image.setLocation(entity.getImage().getLocation());
为了显示图像,我添加了
image.setLocation(entity.getImage().getLocation());
in my product dto converter.在我的产品 dto 转换器中。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.