“Komponent przeładowania kątowego” Kod odpowiedzi

Strona odświeżania kątowego bez ponownego ładowania

this.router.navigate(['path/to'])
  .then(() => {
    window.location.reload();
  });
DevPedrada

Odśwież stronę Angular

refresh(): void {
    window.location.reload();
}
|_Genos_|

Odśwież bieżący komponent kątowy

  reloadCurrentRoute() {
    let currentUrl = this._router.url;
    this._router.navigateByUrl('/', {skipLocationChange: true}).then(() => {
        this._router.navigate([currentUrl]);
        console.log(currentUrl);
    });
  }
Foolish Fly

Jak ponownie załadować komponent w kątowym

reloadComponent() {
  let currentUrl = this.router.url;
      this.router.routeReuseStrategy.shouldReuseRoute = () => false;
      this.router.onSameUrlNavigation = 'reload';
      this.router.navigate([currentUrl]);
  }
Courageous Chamois

Komponent przeładowania kątowego

reloadCurrentRoute() {
    let currentUrl = this.router.url;
    this.router.navigateByUrl('/', {skipLocationChange: true}).then(() => {
        this.router.navigate([currentUrl]);
    });
}
Courageous Chamois

Załaduj kątowy podrzędny

this.router.navigateByUrl('/RefreshComponent', { skipLocationChange: true }).then(() => {
    this.router.navigate(['Your actualComponent']);
}); 
|_Genos_|

Odpowiedzi podobne do “Komponent przeładowania kątowego”

Pytania podobne do “Komponent przeładowania kątowego”

Więcej pokrewnych odpowiedzi na “Komponent przeładowania kątowego” w TypeScript

Przeglądaj popularne odpowiedzi na kod według języka

Przeglądaj inne języki kodu