Answers for "how to reload a page in angular"

2

angular refresh page without reloading

this.router.navigate(['path/to'])
  .then(() => {
    window.location.reload();
  });
Posted by: Guest on January-06-2021
4

How to Reload a Component in Angular

reloadComponent() {
  let currentUrl = this.router.url;
      this.router.routeReuseStrategy.shouldReuseRoute = () => false;
      this.router.onSameUrlNavigation = 'reload';
      this.router.navigate([currentUrl]);
  }
Posted by: Guest on September-25-2020
1

angular reload component

reloadCurrentRoute() {
    let currentUrl = this.router.url;
    this.router.navigateByUrl('/', {skipLocationChange: true}).then(() => {
        this.router.navigate([currentUrl]);
    });
}
Posted by: Guest on September-25-2020
0

refresh page angular

refresh(): void {
    window.location.reload();
}
Posted by: Guest on March-16-2021
0

reload page angular one time

ngOnInit() {
  if (!localStorage.getItem('foo')) { 
    localStorage.setItem('foo', 'no reload') 
    location.reload() 
  } else {
    localStorage.removeItem('foo') 
  }
}
Posted by: Guest on June-06-2021
0

typescript reload current page

import { DOCUMENT } from '@angular/common';
import { Component, Inject } from '@angular/core';

@Component({
  selector: 'app-refresh-banner-notification',
  templateUrl: './refresh-banner-notification.component.html',
  styleUrls: ['./refresh-banner-notification.component.scss']
})

export class RefreshBannerNotificationComponent {

  constructor(
    @Inject(DOCUMENT) private _document: Document
  ) {}

  refreshPage() {
    this._document.defaultView.location.reload();
  }
}
Posted by: Guest on June-24-2020

Code answers related to "how to reload a page in angular"

Code answers related to "Javascript"

Browse Popular Code Answers by Language