Given the following Router setup:
App.Router.map(function() {
this.resource('posts', function() {
this.route('new');
this.resource('post', { path: ':post_id' }, function() {
this.route('edit');
});
});
});
Is it possible to obtain the path of a route?
Fictitious example:
App.Router.get('path', 'posts.new'); //=> "/posts/new"
Or with a model like:
App.Router.get('path', 'post.edit', model); //=> "/posts/1/edit"
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…