app/scripts/app/todoController.js
/**
		 * Add new task to collection.
		 */
Add new task to collection.
Add new task to collection .
function addTask() {
			if (todo.inputTask) {
                var newTask = {
                    "_id": todo.inputTask,
                    "text": todo.inputTask,
                    "completed": false
                };
                $http.post('http://localhost:3000/add', newTask).then(function(response){
                    todo.tasks.push(newTask);
				    todo.incompleteTasks.push(newTask);
				    todo.inputTask = "";
                }).catch(function(err){
                    console.log(err);
                });
			}
		}
function addTask ( ) { if ( todo . inputTask ) { var newTask = { "_id" : todo . inputTask , "text" : todo . inputTask , "completed" : false } ; $http . post ( 'http://localhost:3000/add' , newTask ) . then ( function ( response ) { todo . tasks . push ( newTask ) ; todo . incompleteTasks . push ( newTask ) ; todo . inputTask = "" ; } ) . catch ( function ( err ) { console . log ( err ) ; } ) ; } }
Add new task to collection.
Add new task to collection .
// Only add task if something actually exists