meteor-pages icon indicating copy to clipboard operation
meteor-pages copied to clipboard

Better Iron-Router Route Names

Open pcorey opened this issue 10 years ago • 3 comments

Hi,

Take a look at my example Gist: https://gist.github.com/pcorey/8736bc682c19cefb17fc

In this example, there are two routes associated with Items: mypages_page and mypages_home0

Ideally, I'd like to be able to specify my own route name so I can do something like {{pathFor 'items'}} instead of linking directly to the /items URL or digging through the meteor-pages internals to find out the route naming convention.

pcorey avatar Apr 23 '15 16:04 pcorey

+1!! My use case is taking advantage of Router.go in Template.events and being able to use the params and query options instead of manually serializing the url (gross)

Router.go('foo.index', {}, { query: myQueryObject }

vs

Router.go('/foo?' + $.param(myQueryObject)

I too had to dig into the source code to find a name like:

Router.go('foo_home0', {}, {query: myQueryObject}

which is not readable at all. would love the ability to specify the route name as part of the initialization options.

PhilVargas avatar Oct 23 '15 15:10 PhilVargas

+1 :+1:

oskareke avatar Nov 25 '15 23:11 oskareke

+1, I think it much better to use with pathFor if you can specify iron-route names

osv avatar Jan 11 '16 16:01 osv