Skip to content

Instantly share code, notes, and snippets.

@elimence
Created September 17, 2014 15:36
Show Gist options
  • Save elimence/af11e5da2579436594c8 to your computer and use it in GitHub Desktop.
Save elimence/af11e5da2579436594c8 to your computer and use it in GitHub Desktop.
// Factories
app.factory('MyFactory', ['$http', function ($http) {
var baseURL = '/billing';
return {
fetch: function () {
var url = baseURL + '/fetch.json';
return $http.get(url);
},
updateCompanyInformation: function (company) {
var url = baseURL + '/update-company-info.json';
return $http.post(url, company);
},
updatePayrollSettings: function (company) {
var url = baseURL + '/update-payroll-settings.json';
return $http.post(url, company);
},
updateCurrencySettings: function (company) {
var url = baseURL + '/update-currency-settings.json';
return $http.post(url, company);
},
updateTaxAndBankingDetails: function (company) {
var url = baseURL + '/update-tax-and-banking-details.json';
return $http.post(url, company);
},
updateReminderSettings: function (company) {
var url = baseURL + '/update-reminder-settings.json';
return $http.post(url, company);
}
}
}]);
// Factories
app.factory('MyFactory', ['$http', function ($http) {
var baseURL = '/billing';
return {
fetch: function () {
var url = baseURL + '/fetch.json';
return $http.get(url);
},
update: function( company, endpoint ){
return $http.post( baseURL + endpoint, company )
}
}
}]);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment