I am using angular $routeProvider in my application to change the urls. I want to get the previous url and replace some of its route parameters.
$routeProvider.when("/editUser/:userId", {
templateUrl: "app/user/userEdit.html",
controller: "UserCtrl"
});
For example, if my previous url is the above one, I want to change it's parameter userId
into something else. (previous url: /editUser/1
, I want to change it to: /editUser/2
)
Can I do something like that using AngularJS?
You can use angular route change events for this purpose, such as
Here is an example
You can store this in any scope values.