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

71
Views
Event emitter stencil undefined

Im building a web component with stencil based on react. The value is emited but its showing undefined on the component when im calling.

  @Event() newModuleClicked: EventEmitter<any>;

  handleClick(e) {
    this.newModuleClicked.emit(e); //data is coming here when clicked
  }



   <ul class="portal-navigation__scrollable">
            {this.dataNavigation.map((item) => (
              <li key={item.id} onClick={() => this.handleClick(item.Name)}>
               {item.Name}
              </li>
            ))}
          </ul>

The component im calling its showing undefined

  <navigation
    [dataNavigation]="data"
    (newModuleClicked)="onChange($event)"
  ></navigation>

  onChange(ev: any) {
    console.log('got data', ev.target.value); //undefined 
  }

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

The value you pass to .emit() will be in the detail property of the CustomEvent the Stencil component emits. So to get the actual name just rewrite your event handler to:

onChange(ev: any) {
    console.log('got data', ev.detail);
}

You can also give the event a more specific type of CustomEvent<any> (the any being derived from the event declaration of EventEmitter<any>):

onChange(ev: CustomEvent<any>) {
    console.log('got data', ev.detail);
}
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!