Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

95
Views
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 answers
Answer question

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 Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!