gpt4 book ai didi

mysql - Onsen UI 使用 Angular 从 mysql 登录验证后,如何显示我的主屏幕?

转载 作者:行者123 更新时间:2023-11-29 23:30:58 26 4
gpt4 key购买 nike

我的应用程序有超过 10 个屏幕,我希望编程顺序能够将每个屏幕保留到不同的 html 文件。在索引文件中,我有登录屏幕,在 Angular Controller 中,我连接到 MySQL 数据库,并返回来自数据库的响应。现在我如何调用主配置文件页面 (profile.html)?

我的JS代码:

var myApp = angular.module('Appname', ['onsen.directives']);
myApp.controller("LogInController", function ($scope, $http) {
$scope.errors = [];
$scope.msgs = [];
$scope.login = function () {

$scope.errors.splice(0, $scope.errors.length);
$scope.msgs.splice(0, $scope.msgs.length);

$http.post('http://192.168.1.2/login.php', {'u':"Username", 'p':"Password"}).
success(function (data, status, headers, config) {
$scope.posts = data;
console.log(data);
alert(data[0].msg);
//here I want to put main page profile.html
}).
error(function (data, status, headers, config) {
alert(data);
});

}});

如果我没有使用正确的方法,你能给我建议另一个例子吗?

最佳答案

希望这条线索能有所帮助。你能尝试一下这样的事情吗?

$scope.ons.navigator.pushPage('profile.html');

关于mysql - Onsen UI 使用 Angular 从 mysql 登录验证后,如何显示我的主屏幕?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/26577839/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com