Perhaps not the prettiest solution but this should work if I understand
your problem correctly.
$routeProvider.
when('/api/users'...).
when('/api/:opt1/users'...).
when('/api/:opt1/:opt2/users'...).
when('/api/:opt1/:opt2/:opt3/users'...)
In 1.2 named groups (wildcards) are supported. Read the docs here:
http://docs.angularjs.org/api/ngRoute/provider/$routeProvider
>From the docs:
"For example, routes like /color/:color/largecode/:largecode*\/edit will
match /color/brown/largecode/code/with/slashes/edit and extract:
color: brown
largecode: code/with/slashes."
BR Erik
http://twitter.com/erikstarck
http://malmostartupstudio.com
On Sat, Apr 12, 2014 at 9:01 AM, Shyam <[email protected]>wrote:
> I have a URL in my app.js containing routes. lets say the url is:
> /api/:opt1/:opt2/:opt3/users
>
> I want that my url will work in any case, i should able to ignore the
> optional parameters( opt1, opt2 or opt3, may be all or few). How can I
> achieve this.
>
> is there any way that i can call $location.path('/users'), and i can
> specify also what are the values of the optional param ?
>
> Please suggest.
>
> --
> You received this message because you are subscribed to the Google Groups
> "AngularJS" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> To post to this group, send email to [email protected].
> Visit this group at http://groups.google.com/group/angular.
> For more options, visit https://groups.google.com/d/optout.
>
--
You received this message because you are subscribed to the Google Groups
"AngularJS" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/angular.
For more options, visit https://groups.google.com/d/optout.