The solution I switched with is to always initialize the models on $ scope with the empty block {} on each controller. This ensures that if the data is not tied to this model, you will still have an empty block to go to your $ http.put or $ http.post method.
myapp.controller("AccountController", function($scope) { $scope.user = {}; // Guarantee $scope.user will be defined if nothing is bound to it $scope.saveAccount = function() { users.current.put($scope.user, function(response) { $scope.success.push("Update successful!"); }, function(response) { $scope.errors.push("An error occurred when saving!"); }); }; } myapp.factory("users", function($http) { return { current: { put: function(data, success, error) { return $http.put("/users/current", data).then(function(response) { success(response); }, function(response) { error(response); }); } } }; });
Another alternative is to use binary || data statement when calling $ http.put or $ http.post to make sure that a specific argument is provided:
$http.put("/users/current", data || {}).then(/* ... */);
source share