While the primary goal is to get things as easy to manage as possible, and as easy as possible to use the same code in multiple places, the underlying feeling is constantly that your systems will have to be converted to Angular 2.0 in a few years. You can’t get too worked up, saying you’re going to wait, because the first few versions of Angular 2 will have problems that you DO NOT want to run into on when you’ve got a system this big. Still, we all need to think ahead for cost-effective purposes.
Components will be a big deal. From what I understand, we’ll be able to run Angular 2.0 and Angular 1.5+ side by side. Since components are inherently isolated, we’ll be able to update components one by one without having to do a full site replace, or even the “Silo” replacement, like how we’ve broken up our most recent 350 webpage system.
Now, there is a component router 3rd party tool, and it’s very cool and people love it, however… we hear that the newer Angular standard router is going to be very good, so we haven’t been using component router.
So, how do you use components in a router? Well, there is an insanely simple “hack” that lets you do it and works just fine.
app.config(['$routeProvider', '$locationProvider', function ($routeProvider, $locationProvider) { // console.log($routeProvider); $routeProvider .when('/', { template: "" }) .when('/:inventory_id', { template: " " }) .when('/:inventory_id/stocklist', { template: " " }) .when .otherwise({ redirectTo: '/' }); }]);
It doesn’t get much simpler than that. You can inject variables and other validation as well, but this shows you just how simple you can start out when you are refactoring into components and preparing for Angular 2.0