2

I am trying to follow the Angular 2 doc for an in-depht understanding of routing with Angular 2 : https://angular.io/docs/ts/latest/guide/router.html#!#route-config

When I try to redirect as explained to a default page, the typescript compiler send me this error :

    Type '{ path: string; redirectTo: string; pathMatch: string; }' is not assignable to type 'Route'.
    Object literal may only specify known properties, and 'pathMatch' does not exist in type 'Route'.

Here is my code :

export const CrisisCenterRoutes: RouterConfig = [
  {
    path: '',
    redirectTo: '/crisis-center',
    pathMatch: 'full'
  },
  {
    path: 'crisis-center',
    component: CrisisCenterComponent,
    children: [
      { path: ':id',  component: CrisisDetailComponent },
      { path: '',     component: CrisisListComponent }
    ]
  },
  {
    path: 'admin',
    component: CrisisAdminComponent
  },
];

I can't find any explanation for this obvious issue. The code compiles when I delete the 'pathMatch' property.

Thanks a lot for your explanations.

1 Answer 1

4

You are on a bit older version. Use @angular/router version should be 3.0.0-beta.2

Sign up to request clarification or add additional context in comments.

2 Comments

Thanks a lot I was going crazy ;)
Seriously... updated from 3.0.0-alpha.8 to beta.2 ... UGH (intellij generated template)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.