myems-admin/app/services/settings/space/spaceequipment.service.js
'use strict';
app.factory('SpaceEquipmentService', function($http) {
return {
addPair: function(spaceID,equipmentID, headers, callback) {
$http.post(getAPI()+'spaces/'+spaceID+'/equipments',{data:{'equipment_id':equipmentID}}, {headers})
.then(function (response) {
callback(response);
}, function (response) {
callback(response);
});
},
deletePair: function(spaceID, equipmentID, headers, callback) {
$http.delete(getAPI()+'spaces/'+spaceID+'/equipments/'+equipmentID, {headers})
.then(function (response) {
callback(response);
}, function (response) {
callback(response);
});
},
getEquipmentsBySpaceID: function(id, headers, callback) {
$http.get(getAPI()+'spaces/'+id+'/equipments', {headers})
.then(function (response) {
callback(response);
}, function (response) {
callback(response);
});
}
};
});