Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Add a login page in my Onsenui app

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

like image 916
charlesen Avatar asked Dec 20 '22 17:12

charlesen


1 Answers

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

like image 145
Tamura Avatar answered Jan 19 '23 01:01

Tamura