router icon indicating copy to clipboard operation
router copied to clipboard

route-href docs is missing

Open CasiOo opened this issue 6 years ago • 9 comments

Documentation for route-href is missing https://aurelia.io/docs/routing The attribute is mentioned in the Cheat sheet, but should also be documented in the main router docs https://aurelia.io/docs/fundamentals/cheat-sheet#routing

CasiOo avatar May 10 '18 18:05 CasiOo

I would also expect navigateToRoute and generate to be part of the main router docs.

CasiOo avatar May 10 '18 18:05 CasiOo

@CasiOo This is something that @HIRANO-Satoshi has brought up with me (a long time ago). I totally agree! It's just finding time.

davismj avatar May 12 '18 06:05 davismj

Yes, thanks.

There is some doc for router configuration but not for its usage at all in the main docs.

HIRANO-Satoshi avatar May 13 '18 23:05 HIRANO-Satoshi

@davismj or somebody Could you give this issue some more priority?

I am confused with an error message, but there is no explanation on route-href.

ERROR [route-href] Error: A value is required for route parameter 'pID' in route 'a-list'.

Docs for navigateToRoute(), navigate(), navigateBack() are also needed.

HIRANO-Satoshi avatar Jun 12 '19 00:06 HIRANO-Satoshi

You have configured a route { route: 'path/to/route/:pID', name: 'a-list' }. You have a link <a route-href="a-list">. It doesn't know how to make the href because you haven't provided a pID. Instead, write this: <a route-href="route: a-list, params.bind: { pID: 123 }">. Then, it will generate href="path/to/route/123".

Does that make sense?

Sorry about the documentation shortage.

davismj avatar Jun 12 '19 01:06 davismj

Thanks, but no. My problem was solved by if.bind="pID_value" as described at https://github.com/aurelia/router/issues/203.

It must be a common pit hole. We need a real document that covers all about how to use the routing. We would really appreciate if you could have time for it.

  • patterns for activating routing

    • <a href="" or <a href.bind=""
    • <a route-href="
    • router.generate()
    • router.navigateToRoute()
    • router.navigateBack() (there are examples at cheatsheet's "Generating Route URLs")
  • explanation of <a href="" or <a href.bind=""

  • explanation of <a route-href="

    • if.bind="value" pattern to avoid the "A value is required for route parameter" error.
  • explanation of router.generate() ...

Anything else? Are there routing events? hooks?

HIRANO-Satoshi avatar Jun 12 '19 02:06 HIRANO-Satoshi

The if.bind thing was resolved. If you're still seeing this issue there's probably a deeper issue. You should never need an if.bind for this case.

davismj avatar Jun 12 '19 17:06 davismj

@davismj what @HIRANO-Satoshi meant I think is the need for doc to cover various scenarios, common errors and how to resolve them.

@HIRANO-Satoshi since you are aware most of them, would you like to give it a try? Others would love it like you do

bigopon avatar Jun 12 '19 22:06 bigopon

I see. Maybe my aurelia-router is 1.6.3 and too old.

@bigopen We have a background story. I'm respecting his Promise.

HIRANO-Satoshi avatar Jun 13 '19 02:06 HIRANO-Satoshi