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

120
Vistas
Accessing HTML loaded through Angular Component

I am showing a HTML Page loaded from my mySql Database and loading it in my angular component through .innerHTML. Looks something like this

get(): void {
this.dataServ.getMds(this.formName).subscribe((value: any) => {
  this.dataSource = value;
  this.form = '<div ng-app="formApp" ng-controller="formController">' + this.dataSource + '</div>';
}); }

With my HTML looking like this

<div [innerHtml]="form | sanitizehtml">
</div>

So I make a request to my backend, get a string back which is the entire HTML code I need. Then load it into my angular and then show it through innerHTML. So far so good but when trying to get values from the HTML code or trying to call a function it doesn't seem to get to Angular and just tells me the function is not defined.

Part of the HTML I am loading with the function "onChange" being called at onclick

<input type="checkbox" id="boxal" name="test1" [checked]="select" onclick="onChange()" (click)="onChange()">

The function in my angular component I am trying to call:

  onChange() {
console.log("TEST")}

Chrome console puts out:

blank:1 Uncaught ReferenceError: onChange is not defined at HTMLInputElement.onclick

My goal would be to be able to dynamically load a HTML form into my angular component and then get the values from the filled out form back.

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