angulartypescriptimagetitlealt

Angular, "title" & "alt" in <img> tag


i want to set <img title=""> attributes for each image. But I want the title that the image itself has. How should I do it in code this below is my code in .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>

Solution

  • Try

    <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>```