J.Tran
J.Tran

Reputation: 153

Possibly unhandled rejection: {}

Please click here to see my issue

I got the error:

Possibly unhandled rejection: {}

I read the solution in this topic : Angular 1.6.0: "Possibly unhandled rejection" error

i tried But i dont know where i put fixed code, please kindly help me, thanks Thanks all !

Upvotes: 3

Views: 9828

Answers (1)

georgeawg
georgeawg

Reputation: 48968

First option is simply to hide an error by disabling them with errorOnUnhandledRejections in $qProvider configuration:

app.config(['$qProvider', function ($qProvider) {
    $qProvider.errorOnUnhandledRejections(false);
}]);

BUT this will only switch off logging. The error itself will remain

The better solution in this case will be - handling a rejection with .catch() method:

service.doSomething()
 .then(function (response) {
   //normal processing
})
 .catch(function (err) {
     console.log(err);
     throw err;
});

Useful Links:

Upvotes: 3

Related Questions