mirror of
https://github.com/ionic-team/ionic-framework.git
synced 2025-11-06 22:29:44 +08:00
Very basic back and forth and splash for Toderp
This commit is contained in:
@ -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">
|
||||
|
||||
@ -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;
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user