Angular 5: onSameUrlNavigation

Viewed 14551

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?

3 Answers
Related