获取角度服务的异步值

时间:2016-06-04 15:47:57

标签: javascript angularjs

getPropertiesByStatusService.js (服务)

(function () {
    appModule.service('getPropertiesByStatusService', ['abp.services.app.property', function (propertyService) {
        this.propertyList = function (filter) {
            propertyService.getPropertiesByStatus({ filter: filter })
                .success(function (result) {
                    return result;
                });
        };
    }
    ]);
})();

index.js (控制器)

(function () {
    appModule.controller('tenant.views.propertymanagement.index', ['$scope',  'getPropertiesByStatusService', function ($scope, getPropertiesByStatusService) {

            var vm = this;
            var list = getPropertiesByStatusService.propertyList(null);

        }]);
})();

你能告诉我如何获得list的价值吗?由于async性质,它没有显示任何价值。

0 个答案:

没有答案