Reputation: 821
I need to register to a state, a route where the parameters has a prefix and a slash (route/to/parPrefix1/:paramValue1/parPrefix2/:paramValue2) and these parameters are all optional, so if the parameter1 is not set, the resulting url should be: route/to/parPrefix2/value2
How can I handle this case?
Then I have a second issue: the date should be specified like this: 20/10/2015 If i solve the first point I could set a parameter per date part, however, is there a more elegant solution?
a real case url: /risultati/destinazioni/:destinations/localita/:locations/partenza/:startingDate/ritorno/:returningDate/adulti/:adults/bambini/:children/eta/:childrenAges/aeroporti/:airports/flessibile/:flexDate/
Upvotes: 1
Views: 937
Reputation: 305
I agree with spanndemic, see http://benfoster.io/blog/ui-router-optional-parameters. Also I think that most of that data should be passed via services or values. Such a long url will always make things much more difficult.
Upvotes: 0
Reputation: 1843
You most likely need to set up multiple routes, that point to the same view:
ex:
route/to/parPrefix1/:paramValue1
route/to/parPrefix1/:paramValue1/parPrefix2/:paramValue2
Upvotes: 1