Skip to content

Instantly share code, notes, and snippets.

@cemeng
Created September 13, 2012 04:23
Show Gist options
  • Save cemeng/3711831 to your computer and use it in GitHub Desktop.
Save cemeng/3711831 to your computer and use it in GitHub Desktop.
Angular HTTP save
```
# Set http authorization for all http (ajax) calls
credentials = $("#credentials").val();
if (credentials != "")
$http.defaults.headers.common['Authorization'] = credentials
$scope.deleteOnZeroQuantity = (item) ->
if item.quantity is "0"
$scope.job_invoice.items.splice $scope.job_invoice.items.indexOf(item), 1
$http.put(invoiceItemURL + item.id, item)
.error ->
alert "Error: cannot update item"
```
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment