0
razieh69 created
hi, i write YearAppService in my application layer and i want to use from this service in my angularjs controller:
(function () {
var controllerId = 'YearCtrl';
angular.module('app').controller(controllerId, [
'$scope', '$location', '$filter', 'abp.services.app.year',
function ($scope, $location, $filter, yearService) {
console.log(yearService);
var vm = this;
vm.DataList = [];
vm.GetDataList = function () {
var skipeCount = (vm.currentPage - 1) * vm.pageSize;
if (skipeCount < 0)
skipeCount = 0;
var input = {
maxResultCount: vm.pageSize,
skipCount: (skipeCount)
};
abp.ui.setBusy(
null,
yearService.getPage(input).success(function (data) {
vm.DataList = data.items;
vm.total = data.totalCount;
})
);
}
vm.GetDataList();
}
}]);
})();
when i log yearService in browser console, i get this result: deleteAsync:function (input, httpParams) getList:function (input, httpParams) getListAsync:function (input, httpParams) getPage:function (input, httpParams) getPageAsync:function (input, httpParams) saveAsync:function (input, httpParams) </span>
but when i call GetDataList function i get this error in browser console:
<span style="color:#FF0000">TypeError: yearService.getPage(...).success is not a function at Object.vm.GetDataList (YearCtrl.js:55) </span>
please help me :cry: :cry: :cry:
1 Answer(s)
-
0
Hi,
Can you try to change your code like this:
yearService.getPage(input).then(function (data) { vm.DataList = data.result.items; vm.total = data.result.totalCount; })
Thanks.