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

97
Vistas
How to use dispatchEvent function from JavaScript without event data to Angular 12 app

I need to use document.element.dispatchEvent(new CustomEvent('myCustomEvent', 'The string that I try to send when fire event from code')) but an sintaxis error was trigged with this code because the second argument of CustomEvent must be an object, can't be an simple string, this is the first problem, I must send the event without data only with simple string and receive it without any another data in angular callback function, any thing about it?

about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

Please use Angular's @Output if you only want to pass data to the parent components.

@Output() public myCustomEvent: EventEmitter<string> = new EventEmitter();

....
this.myCustomEvent.emit('The string that I try to send when fire event from code')

Ref: https://angular.io/guide/inputs-outputs

about 4 years ago · Juan Pablo Isaza Denunciar
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