AngularDart: Namespace of route names hierarchical too?

前端 未结 1 1505
日久生厌
日久生厌 2021-01-14 23:28

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

router.root
           


        
相关标签:
1条回答
  • 2021-01-14 23:39

    It's required that the route names are unique for all direct children of a given parent.

    OK:

    foo
       bar
       baz
    qux
      foo
         bar
         baz
    

    Not OK:

    foo
       bar
       bar
    

    In general it's recommended to have unique route names throughout, for better readability, although it's not a requirement.

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

    One place where non-unique route names can cause issues is with query parameters, as query parameters are prefixed with the route name (not the full path), and can cause leaking of values between routes with the same name (/foo?foo.param1=value). That said, query parameter support is a work-in-progress, so things might change.

    0 讨论(0)
提交回复
热议问题