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

434
Views
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
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!