Skip to content

Edit svg text at runtime #132

@antoniosuteu

Description

@antoniosuteu

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";

Activity

czeckd

czeckd commented on Jul 28, 2021

@czeckd
Owner

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

      Development

      No branches or pull requests

        Participants

        @czeckd@antoniosuteu

        Issue actions

          Edit svg text at runtime · Issue #132 · czeckd/angular-svg-icon