angular-svg-icon icon indicating copy to clipboard operation
angular-svg-icon copied to clipboard

Edit svg text at runtime

Open antoniosuteu opened this issue 4 years ago • 1 comments

I need to change the text of some svg at runtime. I can't seem to access the svg inside the container because it is private.

<svg xmlns="http://www.w3.org/2000/svg"> ... <text id="beginner" fill="#212121">text to change</text> ... </svg>

document.getElementById("beginner").textContent = "My Value";

antoniosuteu avatar Jul 26 '21 11:07 antoniosuteu

Rather than using this angular-svg-icon, the svg as an Angular template may be a better approach for what you're trying to achieve.

Generally modern Angular apps don't mix the type of direct manipulation of the DOM like you're doing. It might be possible to do this via Renderer2.

czeckd avatar Jul 28 '21 06:07 czeckd