1
0
mirror of https://github.com/jcwimer/wrestlingApp synced 2026-05-08 23:11:00 +00:00

Added a search to both api and frontend

This commit is contained in:
2016-03-02 14:08:14 +00:00
parent 817e1fb0c1
commit 9bd36d2cb0
4 changed files with 46 additions and 10 deletions

View File

@@ -1,6 +1,6 @@
app.factory('tournamentsService', function($http){
return {
getAllTournaments: function() {
//since $http.get returns a promise,
@@ -10,6 +10,24 @@ app.factory('tournamentsService', function($http){
return $http.get('/api/tournaments/').then(function(result) {
return result.data;
});
},
searchTournaments: function(search){
return $http({
method: 'GET',
url: '/api/tournaments/',
params: {
search: search
}
}).then(function successCallback(response) {
// this callback will be called asynchronously
// when the response is available
return response.data
}, function errorCallback(response) {
// called asynchronously if an error occurs
// or server returns response with an error status.
return response;
});
}
};