Skip to content

Instantly share code, notes, and snippets.

@techhahn
Last active December 26, 2015 05:09
Show Gist options
  • Save techhahn/7098587 to your computer and use it in GitHub Desktop.
Save techhahn/7098587 to your computer and use it in GitHub Desktop.
var newTodo = todos.add(credentials).then(
function(response) {
$scope.todos.push(response);
console.log(response);
console.log($scope.todos);
$scope.new_desc = "";
}
)
add: function(credentials, savedSchema){
var deferred = $q.defer();
var newTodo = new Todo(credentials);
newTodo.$save(
function(response){
deferred.resolve(response);
},
function(response){
deferred.reject(response);
}
)
console.log(newTodo)
return deferred.promise;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment