79533235

Date: 2025-03-25 09:42:35
Score: 1.5
Natty:
Report link

All these solutions did not work properly for me. In the end i used a service to reload the page:

import { Injectable } from '@angular/core';
import { Subject } from 'rxjs';

@Injectable({
  providedIn: 'root'
})
export class ReloadHomeService {
  private reloadRequest = new Subject<void>();
  reloadRequest$ = this.reloadRequest.asObservable();

  requestReload() {
    this.reloadRequest.next();
  }
}

With this I can just insert the service in the component where I want to trigger the reload:

this.reloadHomeService.requestReload();

In my home component:

this.reloadHomeService.reloadRequest$.subscribe(() => {
      // Do something to reload the data for this page
    });

In this way, angular does only reload the necessary parts of the component, not the whole page.

Reasons:
  • Blacklisted phrase (1): did not work
  • RegEx Blacklisted phrase (1): I want
  • Long answer (-0.5):
  • Has code block (-0.5):
  • Low reputation (0.5):
Posted by: Mo3bius