How to access the viewChild() HtmlElement instance of a component?

Discussão em 'Angular' iniciado por Schnitzler, Maio 9, 2025.

  1. Schnitzler

    Schnitzler Guest

    In reference to this answer: I'm trying to access the HtmlElement instance of a custom component in angular 18 using the viewChild() signal:

    searchBar = viewChild<SearchBarComponent>('searchBar', { read: ElementRef });


    The intellisense is bringing up the read option there, but when passing ElementRef I get a TS error: "Expected 1 arguments, but got 2."

    Continue reading...

Compartilhe esta Página