[英]How to redirect from One page to Another
I am a .NET developer but newbie in Angular js and PHP, I want to redirect to another page after saving the data. 我是.NET开发人员,但是Angular js和PHP的新手,我想在保存数据后重定向到另一个页面。 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. 您没有使用用于完成这项工作的transitionTo方法。 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 window.location.href = "URL"
将浏览器重定向到另一个页面 $state.go('app.page')
for standard router for example 例如,用于标准路由器的
$state.go('app.page')
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');
});
};
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.