Modular route design in Angular Dart to support independently developed feature sets?

[Updated focus question]. AngularDart perfectly supports the design of a modular application in many ways. Does this also apply to route design ? I.e.

Question: Can an application have more than one RouteInitializer ? For example, is the following possible:

 class MyAppModule extends Module { MyAppModule() { ... type(RouteInitializer, // Currently implementedBy takes only one RouteInitializer? // Here we propose, eg, to allow a list. implementedBy: [MyAppRouteInitializerForFeatureSetA, MyAppRouteInitializerForFeatureSetB, MyAppRouteInitializerForFeatureSetC, ]); ... } } 

Use case . I am considering that some of my students work on the same AngularDart project, but on (mostly) mutually exclusive sets of functions. Ideally, I would like them to work independently (as soon as top-level URL prefixes are matched). In this case, they will have their own RouteInitializer s. It would be nice to be able to simply "drop" projects in your subfolders, come time for integration, and not copy the routing insert into one class file.


[Original version of the question] (given that the interface name is RouteInitializer , and not possibly RouterInitializer ), it seems that more than one can be defined.)

  • Does this also apply to route design ? I.e.,
  • How many Router instances can I associate with an Angular Dart application? (I suppose only one.)
  • Can an application have more than one RouteInitializer ? (Given that the name of the RouteInitializer interface, and not possibly the RouterInitializer , it seems that more than one can be defined.
  • If more than one RouteInitializer , then what is the scope of the addRoute name parameter?

Edit: Actually, the last question has its merits in the context of hierarchical routes, so I set it out here: angulardart-namespace-of-route-names-hierarchical-too .

+6
source share
1 answer

Having multiple RouteInitializer is complicated, as you indicated.

Technically, you don't need an angular help form to achieve this.

my_routes.dart

 import 'foo.dart' as foo; import 'bar.dart' as bar; myRouteInitializer(router, views) { views.configure({ 'foo': foo.configureFooRoutes(), 'bar': bar.configureBarRoutes() }); } 

foo.dart

 library foo; import ''; configureFooRoutes(views) => ngRoute( path: '/foo', mount: ...); 

bar.dart

 library bar; import ''; configureBarRoutes(views) => ngRoute( path: '/bar', mount: ...); 

This way, your students can work independently.

+2
source

All Articles