Add properties to routes in angular2

Viewed 2745

I would like to know if it's possible to add a custom property to the routes defined in RouteConfig decorator.

I would like to add whatever a route needs authentication or not:

@RouteConfig([
  {
    path: "/login",
    name: "Login",
    component: LoginComponent,
    authenticate: false,
  },
  {
    path: "/home",
    name: "Home",
    component: HomeComponent,
    authenticate: true
  }
])

If this is possible, how do I get the value "authenticate" in the component?

1 Answers
Related