简体   繁体   中英

Start a function when innerHTML has fully loaded in angular

I was wondering if in Angular, it is possible to get informed when Inner HTML has been fully loaded. I have a web application that fetches a SVG-Image from a server. I need to show it as innerHTML because I need to perform actions on the svg and also call component functions from it. After loading it from the server I have to do some small changes to the SVG and therefore wait untill it is completely loaded in the innerHTML. At the moment I add a picture at the end of the SVG and call the function where I perform the changes on the SVG like this:

<img onload="smallSVGChanges(); this.parent.removeChild(this)">

But I'm pretty sure that this is not he best way to do it.

I have found a related question to this problem, but I don't think that my question is a complete duplicate of this question , because it is almost 10 years old and no angular was used there.

您可以简单地执行此操作<img (onload)="doSomethingOnComponent()">并在相应的打字稿文件中的组件定义内定义函数doSomethingOnComponent

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM