Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

439
Vistas
Best way to refresh parent component in Angular

I have an Error Management page (parent) that pops up a modal (child). In that modal is a Delete button.

Here is the method for that delete button...

public async deleteAsync(): Promise<void> {
    
    try {
      await this.http.delete<any>('https://localhost:7168/api/ErrorManagement/DeleteError/').toPromise();
      this.fetchData();
    } catch (error: any) {
      this.notifyService.showError("Unable to delete " + this.whatYouWantToDelete);
    } finally {
      // Close the modal
      this.bsModalRef.hide();   
    }

  }

After I hit the delete error endpoint, I call the fetchData() method. It is available in the modal because I had sent it from the parent (Error Management page) to the child (modal).

Here is the code for that...

public async fetchDataAsync(): Promise<void> {

    try {
     window.location.reload();
    } catch (error: any) {
      this.pageLoadError = JSON.stringify(error.message);
    }

  }

Right now, I'm using window.location.reload() to try to refresh the parent (which has a list of the errors) AFTER the child (modal) has deleted one of the errors.

Per my example above, what is the best way to refresh a page (parent) after a modal (child) has closed?

about 4 years ago · Santiago Gelvez
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda