我有一个用ngResource定义的工厂:
App.factory('Account', function($resource) {
    return $resource('url', {}, {
        query: { method: 'GET' }
    });
});
我正在对该工厂定义的查询方法进行多次调用。这些调用可以异步发生,但是我需要等待两个调用完成才能继续:
App.controller('AccountsCtrl', function ($scope, Account) {
    $scope.loadAccounts = function () {
        var billingAccounts = Account.query({ type: 'billing' });
        var shippingAccounts = Account.query({ type: 'shipping' });
        // wait for both calls to complete before returning
    };
});
有没有办法用ngResource定义的AngularJS工厂做到这一点,类似于jQuery的$ .when()。then()功能?我不想将jQuery添加到当前项目中。
$then属性,但不公开任何promise对象。$promise完全暴露在1.1.4中