<!DOCTYPE html>
<html>
  <head>
    <meta charset="utf-8">
    <meta name="viewport" content="initial-scale=1, maximum-scale=1, user-scalable=no, width=device-width, height=device-height">
    <title></title>

    <link href="lib/ionic/css/ionic.css" rel="stylesheet">
    <link href="css/style.css" rel="stylesheet">

    <!-- IF using Sass (run gulp sass first), then uncomment below and remove the CSS includes above
    <link href="css/ionic.app.css" rel="stylesheet">
    -->

    <!-- ionic/angularjs js -->
    <script src="lib/ionic/js/ionic.bundle.js"></script>

    <!-- cordova script (this will be a 404 during development) -->
    <script src="cordova.js"></script>

    <!-- your app's js -->
    <script src="js/app.js"></script>
    <script src="js/controllers.js"></script>
    <script src="js/main.js"></script>
  </head>
  <body ng-app="starter">
    <ion-nav-bar class="bar-header bar-stable"></ion-nav-bar>
    <ion-nav-view></ion-nav-view>
  </body>
</html>
<ion-view class="content has-header" view-title="Home">
    <ion-content>
        <div class="content has-header">
            <div class="padding">
                <a href="#/login">
                    <button class="button button-block button-positive">GET BACK</button>        
                </a>
            </div>
        </div>
    </ion-content>
</ion-view>
<ion-view class="content has-header" view-title="Login">
    <ion-content ng-controller="Login">
        <div class="list">
            <label class="item item-input item-stacked-label">
                <span class="input-label">Username</span>
                <input type="text" placeholder="Username" ng-model="input.login">
            </label>
            <label class="item item-input item-stacked-label">
                <span class="input-label">Password</span>
                <input type="password" placeholder="Password" ng-model="input.pass">
            </label> 
        </div>
        <div class="padding">
            <a href="#/home">
                <button class="button button-block button-positive" ng-click="getUser()">SIGN IN</button>        
            </a>
        </div>
    </ion-content>
</ion-view>
app.config(function($stateProvider, $urlRouterProvider) {

  // Ionic uses AngularUI Router which uses the concept of states
  // Learn more here: https://github.com/angular-ui/ui-router
  // Set up the various states which the app can be in.
  // Each state's controller can be found in controllers.js
  $stateProvider


    .state('home', {
      url: '/home',
      templateUrl: 'templates/home.html'
    })
    .state('index', {
      url: '/login',
      templateUrl: 'templates/login.html',
    })
  $urlRouterProvider.otherwise('/login');

})

app.controller('Login', function($scope, $rootScope, $state) {
    $scope.input = {
        login: '',
        pass: ''
    }
    $scope.getUser = function(input) {
        if($scope.input.pass.length > 3) {
            console.log("Verificated!"); 
        } else {
            console.log('Wrong pass!');
        }
    };  
});