Add a login page in my Onsenui app

▼魔方 西西 提交于 2019-12-06 04:51:46

问题


I'd like to set a login page before entering the main page. How can I do that just before this instruction :

<ons-screen page="sliding_menu.html"></ons-screen>

I use The Monaca IDE

Thanks for the help

Charles


回答1:


You can try this way:

index.html

<ons-screen page="login.html"

login.js

function LoginController($scope){
    $scope.login = function(id, password){
        $scope.ons.screen.presentPage('sliding_menu.html');
    }
}

login.html

    <div class="page center" ng-controller="LoginController">
    <div class="row">
        <div class="col">
            <ons-text-input placeholder="id" ng-model="id">             
            </ons-text-input>
        </div>
    </div>
    <div class="row">
        <div class="col">
            <input type="password" placeholder="password" ng-model="password" class="topcoat-text-input">
        </div>
    </div>

    <div class="row">
        <div class="col">
            <ons-button ng-click="login(id, password)">
                Login
            </ons-button>
        </div>
    </div>
</div>

Demo: http://onsenui.github.io/stackoverflow/sliding_menu_login/app/

Download src: http://onsenui.github.io/stackoverflow/sliding_menu_login.zip



来源:https://stackoverflow.com/questions/22144654/add-a-login-page-in-my-onsenui-app

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!