AngularDart: Is the route namespace also hierarchical?

Consider the following initialization of hierarchical routes (excerpt from the AngularDart tutorial ):

router.root ..addRoute( name: 'add', path: '/add', enter: view('view/addRecipe.html')) ..addRoute( name: 'recipe', path: '/recipe/:recipeId', mount: (Route route) => route ..addRoute( name: 'view', path: '/view', enter: view('view/viewRecipe.html')) ..addRoute( name: 'edit', path: '/edit', enter: view('view/editRecipe.html')) ..addRoute( name: 'view_default', defaultRoute: true, enter: (_) => router.go('view', {'recipeId': ':recipeId'}, startingFrom: route, replace:true))); 

Although I understand that the routine path will be unique (built from the paths of its ancestors), is the route namespace also hierarchical or should it be unique?

+2
source share
1 answer

Route names are required to be unique to all direct children of this parent.

OK:

 foo bar baz qux foo bar baz 

Not OK:

 foo bar bar 

In general, it is recommended that you have unique route names throughout, for better readability, although this is not a requirement.

When linking to a route, you must specify the full path of the route foo.bar.baz from the root or provide a relative route binding router.go('foo', parameters: {}, startingFrom: bar)

One place where unique route names can cause problems is query parameters, because query parameters have a route name prefix (rather than a full path) and can leak values ​​between routes with the same name ( /foo?foo.param1=value ) . However, support for query parameters is incomplete, so anything can change.

+2
source

All Articles