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> <h1 class="title">Your Tasks</h1>
</header> </header>
<main class="content content-padded has-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> </main>
</div> </div>
</div> </div>

View File

@ -1,5 +1,7 @@
angular.module('toderp', ['firebase', 'ngRoute', 'ngAnimate']) angular.module('toderp', ['firebase', 'ngRoute', 'ngAnimate'])
.constant('FIREBASE_URL', 'https://ionic-todo-demo.firebaseio.com/')
.controller('ToderpCtrl', function($scope, $rootScope, AuthService) { .controller('ToderpCtrl', function($scope, $rootScope, AuthService) {
$scope.display = { $scope.display = {
screen: 'splash' screen: 'splash'
@ -20,8 +22,8 @@ angular.module('toderp', ['firebase', 'ngRoute', 'ngAnimate'])
}; };
}) })
.factory('AuthService', function(angularFireAuth, $rootScope) { .factory('AuthService', function(angularFireAuth, $rootScope, FIREBASE_URL) {
var ref = new Firebase('https://ionic-todo-demo.firebaseio.com/'); var ref = new Firebase(FIREBASE_URL);
angularFireAuth.initialize(ref, { angularFireAuth.initialize(ref, {
scope: $rootScope, scope: $rootScope,
callback: function(user, err) { callback: function(user, err) {
@ -56,6 +58,7 @@ angular.module('toderp', ['firebase', 'ngRoute', 'ngAnimate'])
.controller('LoginCtrl', function($scope, AuthService) { .controller('LoginCtrl', function($scope, AuthService) {
console.log('Created login Ctrl'); console.log('Created login Ctrl');
$scope.loginForm = { $scope.loginForm = {
email: 'max@drifty.com', email: 'max@drifty.com',
password: 'test' password: 'test'
@ -69,11 +72,11 @@ angular.module('toderp', ['firebase', 'ngRoute', 'ngAnimate'])
}, function(e) { }, function(e) {
$scope.loginError = true; $scope.loginError = true;
}); });
} };
$scope.showSignup = function() { $scope.showSignup = function() {
$scope.setScreen('signup'); $scope.setScreen('signup');
} };
}) })
.controller('SignupCtrl', function($scope, AuthService) { .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; right: 0;
bottom: 0; bottom: 0;
left: 0; left: 0;
height: auto;
overflow: auto; overflow: auto;
} }
/* Hack to force all relatively and absolutely positioned elements still render while scrolling /* Hack to force all relatively and absolutely positioned elements still render while scrolling