filterService.search(request).then(function(data){
if (data.success == true) {
updateView(data, propertyId, check, brand)
}
});
app.service("filterService", function($http, $q) {
return({
search: search,
});
function search(request)
{
var sendUrl = "/filter/getFilter/";
var request = $http({
method: "post",
data: {
request: request
},
url: sendUrl
});
return(request.then(handleSuccess, handleError));
}
function handleError(response) {
if (
! angular.isObject( response.data ) ||
! response.data.message
) {
return( $q.reject( "An unknown error occurred." ) );
}
return($q.reject(response.data.message));
}
function handleSuccess(response) {
return(response.data);
}
});