@@ -815,28 +815,23 @@ figure
815
815
:marked
816
816
Next we declare both Angular 1 and Angular 2 routes as normal:
817
817
818
- + makeExample('upgrade-module/ts/app/divide-routes/app.module.ts' , 'ng1-route' , 'app.module.ts (angular 1 route)' )
819
- + makeExample('upgrade-module/ts/app/divide-routes/hero.module.ts' , 'ng2-route' , 'hero.module.ts (angular 2 route)' )
818
+ + makeExample('upgrade-module/ts/app/divide-routes/app.module.ts' , 'ng1-route' , 'app.module.ts (Angular 1 route)' )
819
+ + makeExample('upgrade-module/ts/app/divide-routes/hero.module.ts' , 'ng2-route' , 'hero.module.ts (Angular 2 route)' )
820
820
821
821
:marked
822
- On our `app.module.ts` we need to add `AppComponent` to the declarations and boostrap array.
822
+ In our `app.module.ts` we need to add `AppComponent` to the declarations and boostrap array.
823
823
824
- Now for the crucial bit: configuring the router itself.
824
+ Next we configure the router itself.
825
825
We want to use [hash navigation](./router.html#-hashlocationstrategy-) in Angular 2
826
826
because that's what we're also using in Angular 1.
827
- We also want to defer the intial navigation until we bootstrap Angular 1, which we do
828
- asynchronously after bootstrapping Angular 2.
829
827
830
828
Lastly, and most importantly, we want to use a custom `UrlHandlingStrategy` that will tell
831
829
the Angular 2 router which routes it should render - and only those.
832
830
833
831
+ makeExample('upgrade-module/ts/app/divide-routes/app.module.ts' , 'router-config' , 'app.module.ts (router config)' )
834
832
835
833
:marked
836
- The only thing left is to manually kickstart the router after both Angular 1 and Angular 2
837
- are bootstrapped:
838
-
839
- + makeExample('upgrade-module/ts/app/divide-routes/main.ts' , 'manually-navigate' , 'main.ts (bootstrap)' )
834
+ That's it! Now we're running both routers at the same time.
840
835
841
836
842
837
.l-main-section
0 commit comments