mirror of
https://github.com/ionic-team/ionic-framework.git
synced 2025-11-07 06:57:02 +08:00
Very basic back and forth and splash for Toderp
This commit is contained in:
@ -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