Open ericmillsio opened 9 years ago
The Riot router uses the URL to drive changes to the application Ours uses the application to drive changes to the URL. So the URL can be anything you'd like. The only time the URL drives the application is on load (or refresh). What ours doesn't do (yet!) is URL patterns like /accounts/:id
So it depends on your situation but I suspect if it's not using URL params then ours would be fine.
e.g.
// Adding a state with collection prop
this.router.add({
name: 'accounts',
url: '/accounts',
collection: 'accounts'
});
// Adding a child state of accounts
this.router.add({
name: 'accounts.create',
url: '/accounts/create'
});
// Handling state transitions
rg.router.on('go', function(state) {
state.collection...
});
Ok cool thanks. I appreciate the example too. :) Good work all around on RiotGear!
Thanks! I've started working on the params so you'll be able to do this:
/users/:id
And it will pick up the value in the URL:
/users/123
And add it to state like this:
rg.router.on('go', function(state) {
state.params.id // 123
});
Will update this issue when it's complete ;-)
@crearc Could you give the latest a go? Hopefully you can use template URLs now to accomplish what you want!
@gregorypratt I'm using the new feature in one of my projects and it's working fine, thank you!
There's a little issue, though. I have to refresh the document to go to a different location when I write the URL in the address bar.
Will look into it!
On 30 Sep 2015, at 18:05, Juan Martínez notifications@github.com wrote:
@gregorypratt I'm using the new feature in one of my projects and it's working fine, thank you!
There's a little issue, though. I have to refresh the document to go to a different location when I write the URL in the address bar.
— Reply to this email directly or view it on GitHub.
The Riot.js core library has the ability to do routing for collections, ie '/account//create'. Does this library support doing that? Can't seem to figure out how I'd go about it. Any examples? Or should I just use the core lib in conjunction?