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

169
Visualizações
How to load the parent page again on the close of child pop up page in angular

I am trying to do the following:

  • I have a parent page "movies", in which I have a button "add movies". which when clicked would open a pop-up page.

  • I will add the new movie and click on save in pop-up page. It will be added to the database as expected.

  • However, after adding the new movie, pop will close and control comes to the parent page and it should display the newly added movie name there, which is not happening.

  • The parent page will show the newly added movie name if I refresh the page. I want the parent page to show the newly added movie when the pop-up closes itself.

about 4 years ago · Juan Pablo Isaza
1 Respostas
Responde à pergunta

0

I assume that you are using the MatDialogModule. In that case, you can parse the result to the parent component on the dialogues afterClosed() and add the new movie to the list.

See this example here : https://material.angular.io/components/dialog/examples#dialog-overview

Or:


class ParentComponent {
 constructor(public dialog: MatDialog) {}

 addMovie(){
  const dialogRef = this.dialog.open()
  
  dialogRef.afterClosed().subscribe(newMovie => <add new movie to list of movies>)
 }
}


class MovieDialog {
 constructor(public dialogRef: MatDialogRef<DialogOverviewExampleDialog>)

 submitMovie() {
  this.dialogRef.close(newMovie)
 }

}

So In the ParentComponent we listen on afterClosed() which will get the newMovie when the MovieDialog this.dialogRef.close(newMovie) closes the dialog and emits the new movie.

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