1. Anuncie Aqui ! Entre em contato fdantas@4each.com.br

How to get the full HTML and CSS (computed styles) of a component in Angular with ViewChild?

Discussão em 'Angular' iniciado por PASHA, Novembro 6, 2024 às 10:03.

  1. PASHA

    PASHA Guest

    I have a component in Angular, and I need to extract the full HTML content along with the computed CSS styles of a specific element using ViewChild. I'm currently able to get the HTML content using:

    @ViewChild('mySelector', { static: false }) mySelector!: ElementRef;
    const htmlContent = this.mySelector?.nativeElement?.innerHTML;


    the html code is missing some css styles

    link here is the link to stackblitz

    Continue reading...

Compartilhe esta Página