“Jak ponownie załadować komponent w kątowym” Kod odpowiedzi

Jak odświeżyć stronę kątową

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_|

Jak zrobić przeładowanie komponentu w kątowych

DeleteEmployee(id:number)
  {
    this.employeeService.deleteEmployee(id)
    .subscribe( 
      (data) =>{
        console.log(data);
        this.ngOnInit();
      }),
      err => {
        console.log("Error");
      }   
  }
Famous Fly

Odpowiedzi podobne do “Jak ponownie załadować komponent w kątowym”

Pytania podobne do “Jak ponownie załadować komponent w kątowym”

Więcej pokrewnych odpowiedzi na “Jak ponownie załadować komponent w kątowym” w TypeScript

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

Przeglądaj inne języki kodu