In my app if I receive password reset instructions I go to server with url like:
/changepass?key=1231231231212312
in controller I have such code:
if (typeof $routeParams.key !== 'undefined') {
$scope.changePassword();
}
but when I change password and want to login in same view, I go to another location, but this ?key=123123123
is still there. What did I do wrong, and how to go to empty: /company without any keys?
$scope.login = function() {
***
$location.path('/company');
***
};
also I tried $scope.$apply($location.path('/company'));
but still when I go to company after login I have params in url. How to solve this?
In routing:
.when('/signin', {
templateUrl: 'views/authorization.html',
controller: 'AuthorizationCtrl'
})
.when('/changepass', {
templateUrl: 'views/authorization.html',
controller: 'AuthorizationCtrl'
})
There are two ways by using which you can achieve this
$location#url
$location.url($location.path('/company'));
$location.search
$location.search('key', null);
When you are using angularjs you can use its built in functions like angular.isDefined
if(angular.isDefined($routeParams.key)){
$scope.changePassword();
}