In .NET MVC there is @Url.Action()
and in RoR there is url_for()
I could not find similar url building helper in angularjs.
I'm already providing everything that is needed to build url to $routeProvider
so something like:$routeProvider.urlFor("MyCtrl", {id: 5})
could be nice to have.
My main goal here is to avoid hardcoded urls in views and other places and to avoid repeating url/routes patterns twice.
What would be good solution for my goals?
P.S. I asked same question in stackoverflow but didn't get answer yet. http://stackoverflow.com/questions/15324039/how-to-create-a-url-for-link-helper-in-angularjjs
$routeProvider.when('/:lang/tv/:channelPid?', { templateUrl: 'tv/tv.html', controller: 'TvController' });
$routeProvider.when('/:lang/:catalog/:pid/:title?', { templateUrl: 'details/details.html', controller: 'DetailsController' });