鑑於以下路由器設置:如何檢索路線的路徑?
App.Router.map(function() {
this.resource('posts', function() {
this.route('new');
this.resource('post', { path: ':post_id' }, function() {
this.route('edit');
});
});
});
是否有可能獲得路徑路由的?
虛擬的例子:
App.Router.get('path', 'posts.new'); //=> "/posts/new"
或用相似的模型:
App.Router.get('path', 'post.edit', model); //=> "/posts/1/edit"
也許你想看一看源代碼。 ['LinkView'](https://github.com/emberjs/ember.js/blob/master/packages/ember-routing/lib/helpers/link_to.js#L112-L117)實現了這一點 – MilkyWayJoe 2013-05-09 21:05:23