mgechev / dynamic-route-creator

[DEPRECATED] Demo for dynamically defining routes in Angular 2
MIT License
19 stars 16 forks source link

Error in AppCmp.getAppRoutes() ? #2

Open vincentwinkel opened 8 years ago

vincentwinkel commented 8 years ago

Hi, Thanks for your project. I'm learning Angular2 so maybe I'm wrong, but I think there is an error here (AppCmp.getAppRoutes(), in app.ts line 91) return { path: [/${route.as}], name: route.as }; should be return { path: [${route.path}], name: route.as };

Moreover, can you show an example including 2 components sharing your routerConfigurator service in separate files ? I try to do that, but when I add routes in my child component, I've an error (I can describe but it's not the goal of Issues :) ...) Thanks !

vincentwinkel commented 8 years ago

Update: according to this doc: https://angular.io/docs/js/latest/api/router/RouteRegistry-class.html

It's seems possible to directly use this.registry.config(component, route) and this.registry.configFromComponent(component) instead of this.updateRouteConfig(component, ...) and this.getRoutes().

This solution allows this module to work with Angular Universal.

mgechev commented 8 years ago

@vincentwinkel worry for the late response. I'd appreciate a PR with the suggested change.