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

标签 mysql angularjs onsen-ui

我的应用程序有超过 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/

相关文章:

mysql - 事件记录列中出现频率最高的值

mysql - 教义 : a more efficient way to fetch all related entities in one swoop?

angularjs - POST请求有效(状态200),但满足失败条件

javascript - 如何从一个页面重定向到另一个页面

onsen-ui - 温泉开关不记得它的状态(并且未调用选中的开关上的功能)?

javascript - Monaca.getDeviceId() 无法设置为变量

php - 通过HTML表单使用bindParam对数据库执行PDO

javascript - 当我在表格元素上滚动时 ion-scroll 上的 stopPropagation

onsen-ui - Onsen UI ons.notification.alert 问题

mysql - JOIN 或 UNION - 不确定哪个,也许两者都有