“kątowy komponent odświeżania przycisku kliknij” Kod odpowiedzi

Przycisk przeładowania strony za pomocą Angular

at template use event buinding:
	(click)="reloadCurrentPage()"
inside the .ts file, add the function,
reloadCurrentPage() {
    window.location.reload();
   }
Funny Frog

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

Kliknij Kliknij Strona odświeżania zdarzenia zdarzenia

<a href="javascript:void(0);" (click)="yourClickEvent();">A Tag</a>
Grumpy Gull

kątowy komponent odświeżania przycisku kliknij

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

Odpowiedzi podobne do “kątowy komponent odświeżania przycisku kliknij”

Pytania podobne do “kątowy komponent odświeżania przycisku kliknij”

Więcej pokrewnych odpowiedzi na “kątowy komponent odświeżania przycisku kliknij” w JavaScript

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

Przeglądaj inne języki kodu