mirror of
https://github.com/ionic-team/ionic-framework.git
synced 2025-11-07 06:57:02 +08:00
More controller work
This commit is contained in:
@ -97,7 +97,7 @@ angular.module('ionic.todo.controllers', ['ionic.todo'])
|
||||
$scope.addTask = function(task) {
|
||||
var t = {};
|
||||
t = angular.extend({
|
||||
id: $scope.user.id
|
||||
id: $scope.user.id
|
||||
}, task);
|
||||
|
||||
console.log("Adding task:", t);
|
||||
@ -124,9 +124,22 @@ angular.module('ionic.todo.controllers', ['ionic.todo'])
|
||||
|
||||
console.log("Adding project:", p);
|
||||
|
||||
$scope.projects.push(t);
|
||||
$scope.projects.push(p);
|
||||
|
||||
$scope.task = {};
|
||||
// Reset the form
|
||||
$scope.newProject = {};
|
||||
};
|
||||
|
||||
// Check if we need to create an initial list
|
||||
taskRef.on('value', function(snapshot) {
|
||||
if(!snapshot.val()) {
|
||||
var title = prompt('Create your first list:');
|
||||
if(title) {
|
||||
$scope.addProject({
|
||||
title: title
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
})
|
||||
|
||||
|
||||
Reference in New Issue
Block a user