Reputation: 8638
Is it possible to have the same route provider with a fixed and/or undefined Id.
For example:
$routeProvider.when('/workspace/:workspaceId', { ... });
but I would like to load the same view/controller/route for:
$routeProvider.when('/workspace/:workspaceId/:id', { ... });
C# Web API2 handles this like:
[Route("api/workspace/{id?}")]
Thanks!
Upvotes: 0
Views: 212
Reputation: 3837
According to the documentation:
path
can contain optional named groups with a question mark: e.g.:name?
So it would look very similar to Web API:
$routeProvider.when('/workspace/:workspaceId/:id?', { ... });
Upvotes: 1