Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

156
Vistas
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 la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda