Angularjs 1.7.9 - 可能未处理的拒绝

12 浏览
0 Comments

Angularjs 1.7.9 - 可能未处理的拒绝

我无论使用$promise.then(success, err)还是$promise.then(success).catch(err),都会经常出现Possibly unhandled rejection错误。请问我应该怎么做才能修复这个错误。谢谢。


这是代码:

this.User = $injector.get('User');
this.User.get(id).$promise
.then(fn, fn)

在User资源中:

class UserResource {
    constructor($resource) {
        'ngInject';
        this.$resource = $resource;
    }
    get(id) {
        return this.$resource(apis.user + id).get();
    }
}

0