harbor/static/ng/resources/js/services/search/services.search.js

32 lines
668 B
JavaScript
Raw Normal View History

(function() {
'use strict';
angular
.module('harbor.services.search')
.factory('SearchService', SearchService);
SearchService.$inject = ['$http', '$log'];
function SearchService($http, $log) {
return Search;
2016-05-01 19:46:50 +02:00
function Search(keywords) {
return $http({
method: 'GET',
url: '/api/search',
transformRequest: function(obj) {
var str = [];
for(var p in obj)
str.push(encodeURIComponent(p) + "=" + encodeURIComponent(obj[p]));
return str.join("&");
},
data: {'q': keywords}
});
}
}
})();