user1394625 user1394625 - 5 months ago 108x
AngularJS Question

Angualr 2 router (RC) vs (Deprecated)

Noticed that the new release candidate (RC) router does not contain the 'name' param in the @Routes decorator. However, the docs on clearly mention 'name' when describing routes with the RC Router. Is this just a copy/paste problem with the docs or is there an intent to add the 'name' param back into the mix?

If the 'name' param is gone for good, what's the reasoning and is there any documentation that clarifies the differences between the deprecated router and the RC router?

(RC) Router example:

{path: '/crisis-center', component: CrisisListComponent},
{path: '/heroes', component: HeroListComponent},
{path: '/hero/:id', component: HeroDetailComponent}

(Deprecated) Router

{path: '/crisis-center', name: 'CrisisCenter', component: CrisisListComponent},
{path: '/heroes', name: 'Heroes', component: HeroListComponent},
{path: '/hero/:id', name: 'HeroDetail', component: HeroDetailComponent}

Link to the new docs that mention 'name' param still present in the RC router:


The name parameter is gone for good. The reason was lazy loading of routes and routed components. In router-deprecated this caused issues because the routes needed to be loaded for the names to be known. Now only the path is supported for navigating and no need to load routes and components until the path points to a route that wasn't yet loaded.