I have this code in my service.js
function myService($http, $log) {
var API = 'https://myapi.net/api/api.php?';
$log.debug(API);
return {
getApi: function(inputValue, inputValue2) {
return $http({
url:API + inputValue + '=' + inputValue2,
method:'GET'
})
}
};
}
and in my controller:
vm.searchNetflix = function() {
netflixService.getApi(vm.searchResult, vm.searchResult2).then(function(result){
vm.ResultSearch = result.data;
$log.log('result' + result);
});
};
This 2 values "SearchResult and SearchResults" I call in input, and change the api url,
example: https://myapi.net/api/api.php?mySearchResult=mySearchResult2
when I type a value it returns something right, and if I type something not valid, returns 404, or 400, if a of values is empty.
How I can valid this status, and return in my view?
Thks :)