【发布时间】:2014-10-31 19:57:50
【问题描述】:
我正在关注 app.js 中的 init 函数
$scope.init = function ()
{
if(localStorage.getItem("id")!=null && localStorage.getItem("pass")!=null)
{
alert(localStorage.getItem("id")+" "+localStorage.getItem("pass"));
var id=localStorage.getItem("id");
var pass=localStorage.getItem("pass");
$http({method: 'GET', url: site+'/login-web.php?txt_email='+id+'&txt_password='+pass}).
success(function(data, status, headers, config)
{
if(data=='error')
navigator.notification.alert("Wrong username or password.",null,"Attention.!","Try Again.!");
else
{
localStorage.setItem("id", id);
localStorage.setItem("pass", password);
alert("fire");
$scope.ons.navigator.pushPage('dashboard.html',{title : 'title'});
}
}).
error(function(data, status, headers, config)
{
alert("Please check Mobile Data.");
// called asynchronously if an error occurs
// or server returns response with an error status.
});
}
},
我是来自
的火初始化<body ng-controller="AppController" ng-init="init()">
如果我第一次登录,我想喜欢这个,然后我需要登录,我存储 id 并传入 localstorage,每次加载应用程序和 init 方法时,我检查 id 并从 localstorage 和火服务器传递方法来检查 id 并在其正确登录是否自动完成时通过。
我正在使用 phonegap + onsenui + angular js。
问题出在init方法
$scope.ons.navigator.pushPage('dashboard.html',{title : 'title'});
没有重定向到仪表板。
【问题讨论】:
标签: angularjs cordova onsen-ui