Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

160
Visualizações
Render Angular Material Component in Server

I have a task where I need to render a select tag in the server and send it to Angular client. I would like to also apply Angular Material style to it. When generating a normal tag, it is rendered correctly. However, when using mat-select it does display the response as a plain text, without applying styles or anything. I already bypassed the security warning that Angular displays concerning sanitizing the response so this is not the problem.

insert.service.ts: (service to get response from server)

getFamilies() {
    return this.http.get(this.familyUrl, { responseType: 'text' });
  }

insert.components.ts:

html: any;
ngOnInit(): void {
    this.getFamilies();
  }
getFamilies() {
    this.insertService.getFamilies().subscribe((response) => {
      this.html = response;
    });
  }

insert.component.html: (html file where the response needs to be displayed)

<div class="flex justify-start items-center px-6" [innerHTML]="html | families"> </div>

Note that 'families' is the name of the pipe that is used to bypass the security of html (bypassSecurityTrustHtml() function).

What can be a solution?

about 4 years ago · Juan Pablo Isaza
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda