Toderp working and fixed content sizing issue.

This commit is contained in:
Max Lynch
2013-09-11 19:03:19 -05:00
parent ccf90871f1
commit ea6c4a051a
3 changed files with 33 additions and 5 deletions

View File

@ -86,6 +86,17 @@
<h1 class="title">Your Tasks</h1>
</header>
<main class="content content-padded has-header">
<form ng-submit="addTask(task)">
<input type="text" ng-model="task.text">
<button type="submit" class="button button-block button-success">Add</button>
</form>
<div id="tasks">
<ul class="list">
<li class="list-item" ng-repeat="task in tasks">
{{task.text}}
</li>
</ul>
</div>
</main>
</div>
</div>

View File

@ -1,5 +1,7 @@
angular.module('toderp', ['firebase', 'ngRoute', 'ngAnimate'])
.constant('FIREBASE_URL', 'https://ionic-todo-demo.firebaseio.com/')
.controller('ToderpCtrl', function($scope, $rootScope, AuthService) {
$scope.display = {
screen: 'splash'
@ -20,8 +22,8 @@ angular.module('toderp', ['firebase', 'ngRoute', 'ngAnimate'])
};
})
.factory('AuthService', function(angularFireAuth, $rootScope) {
var ref = new Firebase('https://ionic-todo-demo.firebaseio.com/');
.factory('AuthService', function(angularFireAuth, $rootScope, FIREBASE_URL) {
var ref = new Firebase(FIREBASE_URL);
angularFireAuth.initialize(ref, {
scope: $rootScope,
callback: function(user, err) {
@ -56,6 +58,7 @@ angular.module('toderp', ['firebase', 'ngRoute', 'ngAnimate'])
.controller('LoginCtrl', function($scope, AuthService) {
console.log('Created login Ctrl');
$scope.loginForm = {
email: 'max@drifty.com',
password: 'test'
@ -69,11 +72,11 @@ angular.module('toderp', ['firebase', 'ngRoute', 'ngAnimate'])
}, function(e) {
$scope.loginError = true;
});
}
};
$scope.showSignup = function() {
$scope.setScreen('signup');
}
};
})
.controller('SignupCtrl', function($scope, AuthService) {
@ -83,5 +86,18 @@ angular.module('toderp', ['firebase', 'ngRoute', 'ngAnimate'])
};
})
.controller('TasksCtrl', function($scope) {
.controller('TasksCtrl', function($scope, angularFireCollection, FIREBASE_URL) {
var taskRef = new Firebase(FIREBASE_URL + '/tasks');
$scope.tasks = angularFireCollection(taskRef);
$scope.addTask = function(task) {
var t = {};
t = angular.extend({
id: $scope.user.id
}, task);
console.log("Adding task:", t);
$scope.tasks.add(t);
$scope.task = {};
};
});

View File

@ -38,6 +38,7 @@ body {
right: 0;
bottom: 0;
left: 0;
height: auto;
overflow: auto;
}
/* Hack to force all relatively and absolutely positioned elements still render while scrolling