“Cómo recargar un componente en angular” Código de respuesta

Cómo refrescar la página Angular

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

Actualizar el componente de corriente angular

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

Cómo recargar un componente en angular

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

componente de recarga angular

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

Recargar sub componente angular

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

cómo hacer que un componente recargue en angular

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

Respuestas similares a “Cómo recargar un componente en angular”

Preguntas similares a “Cómo recargar un componente en angular”

Más respuestas relacionadas con “Cómo recargar un componente en angular” en TypeScript

Explore las respuestas de código populares por idioma

Explorar otros lenguajes de código