Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/ionic-framework/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript $http身份验证用于具有Sails.js后端的Ionic应用程序_Javascript_Ionic Framework_Sails.js_Ionic - Fatal编程技术网

Javascript $http身份验证用于具有Sails.js后端的Ionic应用程序

Javascript $http身份验证用于具有Sails.js后端的Ionic应用程序,javascript,ionic-framework,sails.js,ionic,Javascript,Ionic Framework,Sails.js,Ionic,我有一个移动应用程序: 前端-离子框架 后端-Sails.js API 我需要帮助来设置Ionic应用程序,并为以下内容创建注册和登录流: 用户名/密码注册和登录 使用用户控制器设置Sails.js后端 将它们绑定在一起,以便用户可以创建帐户和登录 谁能给我指一下正确的方向吗。非常感谢您的帮助。谢谢这是我的登录模板 <script id="templates/sign-in.html" type="text/ng-template"> < ion - view >

我有一个移动应用程序:

前端-离子框架

后端-Sails.js API

我需要帮助来设置Ionic应用程序,并为以下内容创建注册和登录流:

  • 用户名/密码注册和登录

  • 使用用户控制器设置Sails.js后端

  • 将它们绑定在一起,以便用户可以创建帐户和登录


  • 谁能给我指一下正确的方向吗。非常感谢您的帮助。谢谢这是我的登录模板

    <script id="templates/sign-in.html" type="text/ng-template">
        < ion - view > < div class = "bar bar-header bar-positive" > < h1 class = "title" > Sign - In < /h1>
                </div > < ion - content style = "margin-top:40px !important" > < div class = "list list-inset" > < label id = "acc"
        class = "item item-input" > < input type = "text"
        ng - model = "user.account"
        placeholder = "Account" > < /label>
                        <label id="user" class="item item-input">
                            <input type="text" ng-model="user.user" placeholder="Username">
                        </label >
    
        < label id = "pass"
        class = "item item-input" > < input type = "password"
        ng - model = "user.password"
        placeholder = "Password" > < /label>
                    </div > < div class = "padding" > < button class = "button button-block button-positive"
        ng - click = "signIn(user)" >
            Sign - In < /button>
                    </div > < div id = "error"
        style = "color:#a94442;"
        class = "item item-divider" >
    
        < /div>
                </ion - content > < /ion-view>
    </script>
    

    我投票结束这个问题,因为“要求家庭作业帮助的问题必须包括你迄今为止为解决问题所做工作的总结,以及你解决问题的困难的描述。”
    $scope.signIn = function signIn(user) {
    if (user) {
        var ath = user.account + ',' + user.user + ',' + user.password;
        var url = "http://youradress.com/you";
        var config = {
            headers: {
                'Credentials': ath
            }
        };
        $http.get(url, config).success(function (data, status, headers, config) {
            if (data.indexOf("Permission") > -1) {
                $state.go('devices-list')
            } else {
                error = document.getElementById("error");
                error.innerHTML = "Unable to logged in! Check Credentials";
            }
        }).error(function (data, status, headers, config) {
            error = document.getElementById("error");
            error.innerHTML = "Unable to logged in! Check Internet"
        });
      }
     }