mirror of
https://github.com/ionic-team/ionic-framework.git
synced 2025-11-07 23:16:52 +08:00
I derped my toderp
This commit is contained in:
@ -1,69 +0,0 @@
|
||||
angular.module('ionic.todo.controllers', ['ionic.todo', 'firebase'])
|
||||
|
||||
// The main controller for the application
|
||||
.controller('TodoCtrl', function($scope, $rootScope, AuthService) {
|
||||
$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);
|
||||
});
|
||||
|
||||
$scope.setScreen = function(screen) {
|
||||
$scope.display.screen = screen;
|
||||
};
|
||||
})
|
||||
|
||||
// The login form controller
|
||||
.controller('LoginCtrl', function($scope, AuthService) {
|
||||
console.log('Created login Ctrl');
|
||||
|
||||
$scope.loginForm = {
|
||||
email: 'max@drifty.com',
|
||||
password: 'test'
|
||||
};
|
||||
|
||||
$scope.tryLogin = function(data) {
|
||||
$scope.loginError = false;
|
||||
AuthService.login(data.email, data.password)
|
||||
.then(function(e) {
|
||||
$scope.loginError = false;
|
||||
}, function(e) {
|
||||
$scope.loginError = true;
|
||||
});
|
||||
};
|
||||
|
||||
$scope.showSignup = function() {
|
||||
};
|
||||
})
|
||||
|
||||
// The signup form controller
|
||||
.controller('SignupCtrl', function($scope, AuthService) {
|
||||
$scope.signupForm = {};
|
||||
|
||||
$scope.trySignup = function(data) {
|
||||
AuthService.signup(data.email, data.password);
|
||||
};
|
||||
})
|
||||
|
||||
// The tasks controller (main app controller)
|
||||
.controller('TasksCtrl', function($scope, angularFire, FIREBASE_URL) {
|
||||
var taskRef = new Firebase(FIREBASE_URL + '/todos');
|
||||
$scope.todos = [];
|
||||
angularFire(taskRef, $scope, 'todos');
|
||||
$scope.addTask = function(task) {
|
||||
var t = {};
|
||||
t = angular.extend({
|
||||
id: $scope.user.id
|
||||
}, task);
|
||||
|
||||
console.log("Adding task:", t);
|
||||
$scope.todos.push(t);
|
||||
|
||||
$scope.task = {};
|
||||
};
|
||||
});
|
||||
@ -28,10 +28,10 @@
|
||||
<style>
|
||||
</style>
|
||||
</head>
|
||||
<body ng-controller="TodoCtrl">
|
||||
<body>
|
||||
|
||||
<!-- The root view controller -->
|
||||
<nav-ctrl>
|
||||
<nav-ctrl ng-controller="TodoCtrl">
|
||||
</nav-ctrl>
|
||||
|
||||
<!-- Splash -->
|
||||
|
||||
@ -2,23 +2,15 @@ angular.module('ionic.todo.controllers', ['ionic.todo', 'firebase'])
|
||||
|
||||
// The main controller for the application
|
||||
.controller('TodoCtrl', function($scope, $rootScope, AuthService) {
|
||||
$scope.display = {
|
||||
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);
|
||||
});
|
||||
|
||||
$scope.setScreen = function(screen) {
|
||||
$scope.display.screen = screen;
|
||||
};
|
||||
})
|
||||
|
||||
// The login form controller
|
||||
@ -39,10 +31,6 @@ angular.module('ionic.todo.controllers', ['ionic.todo', 'firebase'])
|
||||
$scope.loginError = true;
|
||||
});
|
||||
};
|
||||
|
||||
$scope.showSignup = function() {
|
||||
$scope.setScreen('signup');
|
||||
};
|
||||
})
|
||||
|
||||
// The signup form controller
|
||||
|
||||
Reference in New Issue
Block a user