I have no way to change the endpoint, and it will return a 200 OK response with different data if it does not work. How to make error function run (second function in thenfrom promise)?
MyService Service:
self.getData = function() {
return $http.get('/api/controller/action').then(function(x) {
return x.data;
}, function(x) {
return x;
});
};
controller:
MyService.getData().then(function(x) {
}, function(x) {
});
source
share