ember.js - How to create route in right way? -


i need create 2 route

/users/philosophy

/topic/philosophy

on /users/ there list of categories , on topic list of categories. on /users/philosophy there list of users category , same topic. categories same. created router:

this.resource('categories', { path: '/:section' }, function(){     this.resource('category', {path: '/:url'}); }); 

and works. want add filter /users/philosophy/top list of users. tried that:

this.resource('categories', { path: '/:section' }, function(){     this.resource('category', {path: '/:url/:filter'}); }); 

but if remove segment top url, throw error, filter param became necessary. how can make filter param unnecessary? or please way build router.

seems talking ember query params.

app.categoriescategory = ember.controller.extend({   queryparams: ['filter'],   filter: '' /* default value */ }); 

and transit user route filter parameter use following helper

{{#link-to 'categories.category' url (query-params filter="top")}}show top{{/link-to}} 

if not want use parameter skip query params.


Comments