Skip to content

Instantly share code, notes, and snippets.

@daretodave
Created May 19, 2019 13:15
Show Gist options
  • Save daretodave/ddcaecf51431fd1fbf3e5a66bbdf4f67 to your computer and use it in GitHub Desktop.
Save daretodave/ddcaecf51431fd1fbf3e5a66bbdf4f67 to your computer and use it in GitHub Desktop.
import {DefaultRouteReuseStrategy} from '@angular/router/src/router';
import {ActivatedRouteSnapshot} from '@angular/router';
export class CustomRouteReuseStrategy extends DefaultRouteReuseStrategy {
shouldReuseRoute(future: ActivatedRouteSnapshot, curr: ActivatedRouteSnapshot): boolean {
let name = future.component && (<any>future.component).name;
return super.shouldReuseRoute(future, curr) && name !== 'ThisWouldBeAComponentThatShouldReload';
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment