javascript - How to get value of REST style parameter in Angular? -
i have application in asp.net mvc. use rest-style parameters. address of 1 action http://app/resource/action/id.
in angular can access query strings using $location.search() or $routeparams.search or $window.location.search. though of these methods can obtain query string parameters.
how can access id parameter (without splitting window.location.pathname)?
in route configuration can this:
$routeprovider. when('/:resource/:action/:id', { templateurl: 'partials/your-partial.html', controller: 'yourctrl' })
you can use $routeparams access properties require follows:
var resource = $routeparams.resource; var action = $routeparams.action; var id = $routeparams.id;
Comments
Post a Comment