jeudi 5 février 2015

Ember: How do I remove dynamic segements from my route if their values are null?

I have a search route with many parameters. At the moment my URL contains all of the parameters set to default values if they aren't set by the user. I want to be able to remove, add the parameters to URL depending on whether the user has selected them. For instance. If the user has selected both min and max prices and sizes it would be;



minprice/0/maxprice/5000000/minsize/0/maxsize/10000/


But if they have only selected price it would be;



minprice/0/maxprice/5000000


I have tried to use the serialize method in my search route, but that seems only to pass the dynamic segments to the router which I have defined, with the rest coming up undefined.


So how can I dynamically add/remove dynamic segments to my route?


Thanks





Aucun commentaire:

Enregistrer un commentaire