I have a route string like the following var global_book_route = /books/:id specified in a variable.
I want to be able to use $route or $location to deep link to this route in a controller, is there a way to do this without re-specifying the url prefix?
This would work: var id=1; $location.path('books/'+id') -> '/books/1'
However, this does not: $location.path(global_book_route).search({id:1}) -> 'books/:id?id=1'
Is there a way I can use the route specified in the string to go to the correct location?
$location.path('books/' + id)adequate? The use of variables in routes are for accessing them in the request (the part that happens after$location)$location.path('users/'+user.id+'/accounts/'+account.id)- what if the account route changes to 'users/:userId/:accountId' ?/_api/v2/to/_api/v3/, you have to change your code to reflect that.buildUserUrl(user.id, account.id)which would result in'users/1/accounts/2'