Angularjs Refresh Page Without Reloading Code Example


Example 1: how to refresh page angular

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

Example 2: angular reload component

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

Example 3: angular 6 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();   } }

Comments

Popular posts from this blog

Are Regular VACUUM ANALYZE Still Recommended Under 9.1?

Can Feynman Diagrams Be Used To Represent Any Perturbation Theory?