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

205
Visualizações
Output and EventEmtiter not sending any data

I want to send data from my child component to my parent component using the Output() and EventEmitter methods. However, it appears as though nothing is being sent through, despite the function the emitter is in being hit in the child component?

My child component:

@Output() urlStringEvent = new EventEmitter<string>();

ngOnInit(): void {
    this.startUpload();
  }

startUpload() {
    // Unrelated Code Above ^^^^
    // Assign URL's to Array
    this.task.snapshotChanges().pipe(
      last(),
      switchMap(() => ref.getDownloadURL())
    ).subscribe(url => {
      this.urlStringEvent.emit(url);
    })
  }

In the above startUpload() method, the 'url' response is sent through, however nothing seems to happen with 'this.urlStringEvent.emit(url);'

In my parent component (component.html):

<app-upload-task-training (showEvent)="receiveUrlString($event)"></app-upload-task-training>

component.ts:

receiveUrlString($event: any) {
    console.log($event);
  }

Nothing is logged in the $event as seen above, why could this be?

over 4 years ago · Santiago Trujillo
2 Respostas
Responde à pergunta

0

You are emitting urlStringEvent but in html you using showEvent, It will not work either you can change your html like this

<app-upload-task-training (urlStringEvent)="receiveUrlString($event)"></app-upload-task-training>

OR

Change this

@Output() urlStringEvent = new EventEmitter<string>();

to this

@Output('showEvent') urlStringEvent = new EventEmitter<string>();
over 4 years ago · Santiago Trujillo Relatório

0

You did not properly name the event in your html. Change html code like this:

<app-upload-task-training (urlStringEvent)="receiveUrlString($event)"></app-upload-task-training>
over 4 years ago · Santiago Trujillo 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