Dynamically wrap host element with a component

Discussão em 'Angular' iniciado por Fynn, Fevereiro 22, 2025.

  1. Fynn

    Fynn Guest

    Let's assume we have an Angular component my-comp defined. Is it possible to create a structural directive *my-dir that wraps its host element with the given component? Let's assume, I have no possibility to change the implementation of my-comp.

    Input

    <div *my-dir>Hello World</div>


    Result

    <my-comp>
    <div>Hello World</div>
    </my-comp>

    Continue reading...

Compartilhe esta Página