Created
September 13, 2012 04:23
-
-
Save cemeng/3711831 to your computer and use it in GitHub Desktop.
Angular HTTP save
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
``` | |
# 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