In reviewing the changes with the newly released Angular 5 and reading the following blog: http://blog.ninja-squad.com/2017/11/02/what-is-new-angular-5/
I noticed the addition of a new flag for the Router options to allow a page to reload. I had previously had to implement a but of a hack to make this happen. I was hoping to remove my hack and use this new functionality. The flag is called onSameUrlNavigation. However, the Angular compiler complains when I attempt to use it.
My Code:
import { NgModule } from '@angular/core';
import { RouterModule, Routes } from '@angular/router';
import Properties from './../shared/properties';
const routes: Routes = [
{ path: '', redirectTo: '/' + Properties.ROUTES.catalog.home.route, pathMatch: 'prefix' }
];
@NgModule({
imports: [ RouterModule.forRoot(routes, {onSameUrlNavigation: 'reload'}) ],
exports: [ RouterModule ]
})
export class CoreRoutingModule {}
Error Message:
ERROR in [at-loader] ./app/core/core-routing.module.ts:13:45
TS2345: Argument of type '{ onSameUrlNavigation: string; }' is not assignable to parameter of type 'ExtraOptions'.
Object literal may only specify known properties, and 'onSameUrlNavigation' does not exist in type 'ExtraOptions'.
Any ideas where I am going wrong?
Apparently this change was removed from 5.0.0 and is now being considered for a future release. https://github.com/angular/angular/pull/19463
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With