0

I have this piece of code where the response status code is 403. The problem is it will never fire the second function, it simply does nothing.

I've seen similar errors but people were using interceptors, which I'm not.

 Itens.signUp($scope.user, confirmation).then(function (response) {
   console.log('success');
}, 
 function (response) {
   console.log('error');
});

1 Answers1

1

The below isn't formatted right.

.then(function(response) {
    console.log('success');
  }),
  function(response) {
    console.log('error');
  };
}

It should be like this:

.then(function(response) {
  console.log('success');
}, function(response) {
  console.log('error');
});

Alternatively you could also do this:

.then(function () {
  console.log('success');
})
.catch(function () {
  console.log('error');
});
ScottL
  • 1,755
  • 10
  • 7
  • 1
    Notice there's a [difference between `.then(…).catch(…)` and `.then(…, …)`](http://stackoverflow.com/q/24662289/1048572). – Bergi Sep 02 '16 at 01:40
  • I'm ashamed for that, but it took me almost a day to realize a syntax error. Thanks mate. – Giovani Barcelos Sep 02 '16 at 02:03