chanu1993 chanu1993 - 2 years ago 86
HTML Question

How to change img src in HTML using AngularJS without editing the HTML file?

I have a website done using AngularJS and all the HTML code is loading from database. So we cannot edit the code. It's loading when the application running. But we can edit the JavaScript files. So I have to edit the img src link. Actually I have to add some main url part to it. How can I do this ?

<img src="/img/logo.png"/> to <img src=""/>

This is how this has to be done. No id in the img tag too. Can we use Angular Directives ? And we cannot add anything in the HTML files. No directive name too. Please help me on this. Really stuck in here.

Answer Source

If you're unable to edit the html file then it would be tricky to add angular directives. Have you thought about using jQuery to manipulate img source?

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download