phonegap应用程序在桌面上运行良好,但在移动设备中运行

时间:2018-01-21 14:24:04

标签: angularjs cordova phonegap

我使用angular创建一个登录页面 似乎角度甚至没有在移动中加载我使用了一个可靠的测试角度是否加载 在桌面浏览器中它可以工作,但是当我在我的手机上运行时,角度没有加载且可验证不打印

  $scope.test= 122;  

问题是什么,我也在建设后测试但同样的问题

登录页面是:

<!DOCTYPE html>
<html>
<head>
    <title>Login </title>
    <link href="css/loginnew.css" rel="stylesheet" type="text/css">
    <script src="js/jquery-3.2.1.min.js"></script>
    <!--    <script src="js/angular.js"></script>-->
    <script src="js/angular.min.js"></script>
    <link href="css/bootstrap.min.css" rel="stylesheet">

    <link href="css/sweetalert.css" rel="stylesheet">

    <!-- Google Fonts -->
    <link href='https://fonts.googleapis.com/css?family=Roboto+Slab:400,100,300,700|Lato:400,100,300,700,900' rel='stylesheet' type='text/css'>

    <!--    <link rel="stylesheet" href="css/animate.css">-->
    <!-- Custom Stylesheet -->
    <!--    <link rel="stylesheet" href="css/loginstyle.css">-->



    <style>



        .errorlabel
        {

            color: red;
            font-weight: normal;
            width: 100%;
            border-radius: 0px 0px 8px 8px;
            padding: 0 10px;
            background: rgba(128, 128, 128, 0.28);

        }

    </style>

</head>
<body ng-app="myApp" ng-controller="logincontroller">


<!--
    you can substitue the span of reauth email for a input with the email and
    include the remember me checkbox
    -->
<div class="container">
    <div class="card card-container">
        <!-- <img class="profile-img-card" src="//lh3.googleusercontent.com/-6V8xOA6M7BA/AAAAAAAAAAI/AAAAAAAAAAA/rzlHcD0KYwo/photo.jpg?sz=120" alt="" /> -->
        <img id="profile-img" class="profile-img-card" src="img/user.jpg" />
        <p id="profile-name" class="profile-name-card"></p>
        <form class="form-signin">
            <span id="reauth-email" class="reauth-email"></span>
            <input id="name" ng-model="username" placeholder="     username" type="text" style="    background-color: transparent;
    border-style: solid;
    border-width: 0px 0px 2px 0px;
    border-color: black;
    font-size: 17px;">
            {{test}}
            <input id="password" ng-model="password" placeholder="     **********" type="password" style="    background-color: transparent;
    border-style: solid;
    border-width: 0px 0px 2px 0px;
    border-color: black;
    font-size: 17px;">

            <button class="btn btn-lg btn-primary btn-block btn-signin" ng-click="verifylogin(username , password)"> Login </button>
 <span class="errorlabel">{{errormessage}}</span>           
 <a href="#" class="forgot-password">
            Forgot the password?
        </a>
        </form>
    </div><!-- /card-container -->
</div><!-- /container -->


</body>



<script> function ajaxcall(rurl,rdata,successfunc,title,message)
 {
     alert('aese hi');
    rurl= "https://basit.co/"+rurl ;
    $.ajax({
        url: rurl, data:  rdata  ,
        success: function(data)
        {
            //unblur();
            data = JSON.parse(data);
            //data.data = JSON.parse(data.data);
            if(data.errors.length>0)
            {
                $.each(data.errors, function(ind,e){
                    console.log(" --"+e.message);
                    sweetw('Error', e.message);
                });
            }
            else
            {
                if(successfunc)
                {
                    successfunc(data);
                    return;
                }
                if(rdata.reload)
                {
                    setTimeout(function(){location.reload()},2500);
                }
                console.log();
                if(!title)
                {
                    sweets("Success",'');
                }else{
                    sweets(title,message);
                }

            }

        },
        error: function(jqXHR, textStatus, errorThrown)
        {
            //   unblur();
            console.log(jqXHR);
            alert("Server Error");
        },
        type: 'POST' ,
    });
}</script>


<script>

    var app = angular.module('myApp', []);


    app.controller('logincontroller', function($scope) {

        $scope.loginuser="";
        $scope.errormessage = "";

        $scope.test= 122;
        $scope.verifylogin = function (username,password){

            ajaxcall("backend/accountf.php",{"verifylogin":true,username,password},function(response){

                    console.log(response.data);

                 if( username=="" || !username)
                    {
                         $scope.errormessage= response.data[0].errordetail;
                    }

                   else if(response.data[0].username == username)
                    {
                        $scope.loginuser = username ;
                        var currentpage = "/" + window.location.pathname.split('/')[1];
                        location.href ='indextest.html';
                        $scope.errormessage="";
                    }
                    else
                    {
                        $scope.errormessage= response.data[0].errordetail;
                        // alert(response.data[0].errordetail);
                    }
                    $scope.$digest();
                }
            );
        }

    });

</script>

</html>

2 个答案:

答案 0 :(得分:2)

我在代码中没有看到你的角度模块(myApp)...尝试调用包含角度模块的脚本。

答案 1 :(得分:0)

它可以正常使用android版本大于jellybean而不能用更低版本工作 所以我用打字稿格式发送数据为ajaxcall("backend/accountf.php",{"verifylogin":true,"username":username,"password":password},function(response){ . . . }

现在它可以工作:)