Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

73
Visualizações
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 Respostas
Responde à pergunta

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 Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda