How can I define the routes if the query needs more than one parameter?


#1
Let's assume this scenario : there is a list of different goods on the page, and if you want to query a certain good, the type of the good and the first letter of this good's name should be included for the parameters, so how could I define this route to query the good? Many articles introduced dynamic segment in the route, but there is only one parameter(ofter the id of the model) for the query. What's the way to deal with this scenario? Thanks

#2

You need to define serialize on your route which can use attributes of the model however you see fit for the route segment parameters you have defined in your router.

Alternatively if you are trying to filter within say an index type route then you can look at Embers query params feature which can be enabled in 1.5 and which are used within your controller.


#3
serialize on my route? Could you plz give me a simple example of this? Thanks

#4

The Ember docs are a good place to start. http://emberjs.com/api/classes/Ember.Route.html#method_serialize


#5

Thanks :slight_smile: I’ll take a look at it