I have an application where users can write notes and, in these notes, they can include an image. Sometimes these images are large, and I have CSS that makes them fit into a container.
I am trying to make a click event on any image that may show up in the notes where it will either enlarge the image to see it clearer or open the image in a new tab.
Since the HTML is not written directly in my application, and I get data from the database and display it, I cannot add (click)="doSomething()"
on the image via HTML.
Users can right click on the image and choose to open it in a new tab. But I am trying to simplify that.
I have found approaches where I can add JS on load events to do action on any image on the page, but that is not what I am looking for. I only want to target any image generated in this component.
If needed, I can create a StackBlitz example, but I am hoping it is something simple that I am just missing.
Current HTML:
<div class="row" style="margin-top: 10px">
<div class="col-md-12 note-container ql-editor">
<div
*ngIf="data.isEnabled"
[innerHTML]="data.noteText | safeHtml"
></div>
</div>
<div class="col-md-12 note-container">
<div *ngIf="!data.isEnabled">
<i>This message has been deleted.</i>
</div>
</div>
</div>