Skip to content Skip to sidebar Skip to footer

Routing Not Working In Angular2

My Routing isn't working in Angular2, to demonstrate the point, I have put the same component as the destination for both the root of my site and /login. The component works at htt

Solution 1:

Two routes in one @RouteConfig(...) can't have the same name:

@RouteConfig([
  {
    path: '/',
    name: 'TodoCmp',
    component: TodoCmp,
    useAsDefault: true
  },
  {
    path: '/login',
    name: 'TodoCmp',  <!-- <<<== should be 'Login' instead of 'TodoCmp'component: TodoCmp
  }
])

You should move ROUTER_PROVIDERS to bootstrap() (like HTTP_PROVIDERS)

Post a Comment for "Routing Not Working In Angular2"