Very basic back and forth and splash for Toderp

This commit is contained in:
Max Lynch
2013-09-10 21:16:26 -05:00
parent 1ca594b0cc
commit ccf90871f1
2 changed files with 10 additions and 5 deletions

View File

@ -27,7 +27,9 @@
</head>
<body ng-controller="ToderpCtrl">
<div ng-switch on="display.screen" class="reveal-animation">
<div id="login" ng-switch-when="login"ng-controller="LoginCtrl" class="pane">
<div id="start" ng-switch-when="splash" class="pane">
</div>
<div id="login" ng-switch-when="login" ng-controller="LoginCtrl" class="pane">
<main class="content content-padded has-header">
<div class="container" style="text-align: center">
<h1>ToDerp</h1>
@ -55,7 +57,7 @@
<div id="signup" ng-switch-when="signup" ng-controller="SignupCtrl" class="pane">
<header class="bar bar-header bar-danger">
<a href="#" class="button">Back</a>
<a href="#" class="button" ng-click="setScreen('login')">Back</a>
<h1 class="title">Sign up (it's free!)</h1>
</header>
<main class="content content-padded has-header">

View File

@ -1,14 +1,15 @@
angular.module('toderp', ['firebase', 'ngRoute', 'ngAnimate'])
.controller('ToderpCtrl', function($scope, $rootScope) {
.controller('ToderpCtrl', function($scope, $rootScope, AuthService) {
$scope.display = {
screen: 'login'
screen: 'splash'
};
$rootScope.$on('angularFireAuth:login', function(evt, user) {
$scope.display.screen = 'tasks';
});
$rootScope.$on('angularFireAuth:logout', function(evt, user) {
console.log('Logged out!', evt, user);
$scope.display.screen = 'login';
});
$rootScope.$on('angularFireAuth:error', function(evt, err) {
console.log('Login Error!', evt, err);
@ -23,6 +24,9 @@ angular.module('toderp', ['firebase', 'ngRoute', 'ngAnimate'])
var ref = new Firebase('https://ionic-todo-demo.firebaseio.com/');
angularFireAuth.initialize(ref, {
scope: $rootScope,
callback: function(user, err) {
console.log('AUTH CHANGED', err, user);
},
name: 'user'
});
@ -63,7 +67,6 @@ angular.module('toderp', ['firebase', 'ngRoute', 'ngAnimate'])
.then(function(e) {
$scope.loginError = false;
}, function(e) {
$scope.display.screen = 'signup';
$scope.loginError = true;
});
}