I am a .NET developer but newbie in Angular js and PHP, I want to redirect to another page after saving the data. Here is the following code which i had written, what should i do for that
var url = domain+"/index.php/welcome/insert2?email="+$scope.uemail+"&name="+$scope.uname+"&make="+$scope.umake.id+"&model="+$scope.umodel.id+"&mobile="+$scope.umobile+"&car_reg_no="+$scope.car_regist+"&pincode="+$scope.upincode;
//$log.log(url);
$ionicLoading.show();
$scope.submitData(url).then(function(data){
$log.log(data);
$localstorage.set("uid",data);
$ionicLoading.hide();
});
}
};
you are not using transitionTo method.which is used to do that work. Here is the code snippet you should write after this line
$localstorage.set("uid",data);
write
$state.transitionTo('app.pagename');
Check if it works.
window.location.href = "URL"
to redirect browser to another page$state.go('app.page')
for standard router for example
You can write your code look like given below code-sample
var url = domain+"/index.php/welcome/insert2?email="+$scope.uemail+"&name="+$scope.uname+"&make="+$scope.umake.id+"&model="+$scope.umodel.id+"&mobile="+$scope.umobile+"&car_reg_no="+$scope.car_regist+"&pincode="+$scope.upincode;
//$log.log(url);
$ionicLoading.show();
$scope.submitData(url).then(function(data){
$log.log(data);
$localstorage.set("uid",data);
})
.finally(function () {
$ionicLoading.hide();
// Set URL here to redirect other page.
$state.transitionTo('URL');
}); };