问题描述
我想为每个图像设置<img title="">
属性。但是我想要图像本身具有的title
。我应该如何在代码中做到这一点
这是我在.html
<div class="img-wrapper">
<img src="data:image/png;base64,{{document.file}}" alt="img-alt" title="" class="img" style="width: 100%; height: 100%;">
</div>
解决方法
尝试
<div class="img-wrapper">
<img src="data:image/png;base64,{{document.file}}" [alt]="document.alt" [title]="document.title" class="img" style="width: 100%; height: 100%;">
</div>```