Page Refresh
refresh a whole page window.location.reload();
delay refreshing a whole page
//refresh page delay 3 seconds setTimeout(window.location.reload.bind(location),3000);
//same above setTimeout(location.reload.bind(location), 3000);
reload partial page
this.reload(this.router.url); // reload function
async reload(url: string): Promise { await this.router.navigateByUrl('otherpage', { skipLocationChange: true }); return this.router.navigateByUrl(url); }
delay reload partial page this.delayReload(3000); //1000ms // delay reload function async delayReload(ms: any) { this.router.navigate([this.router.url]) .then(() => { setTimeout(() => { // window.location.reload(); this.router.navigate(['/dashboard']); }, ms); }); }
Last updated