Sunday, July 15, 2018

How to disable browser back button in AngularJS 2 to 6

Use location.onPopState to the same in AppComponent
import { PlatformLocation } from ‘@angular/common’;
constructor(location: PlatformLocation, private router: Router) {
location.onPopState(() => {
console.log(‘pressed back in add!!!!!’);
//this.router.navigateByUrl(‘/multicomponent’);
//history.forward();
});

No comments: