The new new Angular 2 router

If you have been keeping up with Angular 2 and even writing some apps in an serious way you may have noticed that with release candidate 0 of Angular 2 that there is a new router (not the old new router or the defacto router, but a newer new one). So who moved our cheese and why?

If you check out the timeline below (assembled from weekly meeting notes from the Angular team) it seems that sometime around April 11 some design flaw in the router necessitated its deprecation and a new router created. Based around Misko’s talk at ng-conf 2016 it seems to be related to lazy loading and the final hurdles of getting Angular 2 out the door. Those final hurdles include a lot of shuffling of modules, rejiggering to handle offline compilation and cutting of the payload size.

Basically Angular 2 is a victim of Javascript fatigue.

So, what next? Let’s move on, the router is getting plenty of focus from a lot of smart people. The Angular CLI is going to be awesome and hopefully after its out we won’t be talking as much about the lower level moving parts of modules, routing and lazy loading.

The Timeline

May 4th 2016

  • Misko talks about the new (newest?) router at ng-conf (here) and the challenges of lazy loading and incorporation of it with systemjs.
  • Documentation on the Angular 2 router notes :
“This chapter is a work in progress. It describes the release candidate Component Router which replaces the beta router.”

May 2nd 2016

  • The component router formly named as angular/router is replaced as angular/router-deprecated (see commit) as part of the RC0 release (changelog)

April 25th 2016

Notes about the router from Angular Team:

  • New router core works, end to end should work by end of the week
  • Will need docs updates, will sync up with Ward

11th April 2016

Notes about the router from Angular Team:

  • Working towards some API changes in time for Final
  • Will automatically do code-splitting/lazy loading based on Routes if desired
  • Simplifying several concepts and APIs to reduce confusion
  • Resolving some critical corner-case bugs

2nd November 2014

  • Rob Eisenberg announces the new router (now deprecated) at ng-europe (youtube).
Rob Eisenberg demoing lazy loading of routes in the now deprecated component router of Angular 2 (in 2014!)