<cite>drcgreece: </cite> Hi Bilal, We need to see more code to see how you are returning data from server.
But one thing I noticed, is the "result.items". Maybe it should be "result.data.items".
Bilal
Thank you Bilal, its working now! :D
Bilal, I tried this but It is not working for me. This code does not prompt any error but not populating vm.employess array.
Please help me, I am very new to AngularJs.
Thanks in advance!!!
Regards,
Bilal
Hi, I started developing a new module in ASPNetZero AngularJs by reading aspnetzero.com step by step development guide for ASP.NET MVC 5.x & Angularjs 1.x and I got error success is not a function error in DevTool by chrome.
Attached are error, code of index.js and index.cshtml:
Error: Registered to the SignalR server! angular.min.js:122 TypeError: employeeService.getEmployees(...).success is not a function at new <anonymous> (<a class="postlink" href="http://localhost:6240/App/tenant/views/hrm/employees/index.js:9:46">http://localhost:6240/App/tenant/views/ ... ex.js:9:46</a>) at Object.invoke (<a class="postlink" href="http://localhost:6240/Scripts/angular.min.js:43:171">http://localhost:6240/Scripts/angular.min.js:43:171</a>) at R.instance (<a class="postlink" href="http://localhost:6240/Scripts/angular.min.js:93:35">http://localhost:6240/Scripts/angular.min.js:93:35</a>) at n (<a class="postlink" href="http://localhost:6240/Scripts/angular.min.js:68:42">http://localhost:6240/Scripts/angular.min.js:68:42</a>) at g (<a class="postlink" href="http://localhost:6240/Scripts/angular.min.js:60:496">http://localhost:6240/Scripts/angular.min.js:60:496</a>) at <a class="postlink" href="http://localhost:6240/Scripts/angular.min.js:60:119">http://localhost:6240/Scripts/angular.min.js:60:119</a> at Object.<anonymous> (<a class="postlink" href="http://localhost:6240/Scripts/angular-ui-router.min.js:7:24965">http://localhost:6240/Scripts/angular-u ... js:7:24965</a>) at <a class="postlink" href="http://localhost:6240/Scripts/angular.min.js:16:71">http://localhost:6240/Scripts/angular.min.js:16:71</a> at ta (<a class="postlink" href="http://localhost:6240/Scripts/angular.min.js:84:35">http://localhost:6240/Scripts/angular.min.js:84:35</a>) at n (<a class="postlink" href="http://localhost:6240/Scripts/angular.min.js:69:226">http://localhost:6240/Scripts/angular.min.js:69:226</a>) <div ui-view="" class="fade-in-up ng-scope"> (anonymous) @ angular.min.js:122
index.js: (function () { appModule.controller('tenant.views.hrm.employees.index', [ '$scope', 'abp.services.app.employees', function ($scope, employeeService) { var vm = this;
vm.employees = [];
employeeService.getEmployees({}).success(function (result) {
vm.employees = result.items;
});
}
]);
})();
index.cshtml: <div ng-controller="tenant.views.hrm.employees.index as vm"> <div class="row margin-bottom-5"> <div class="col-xs-12"> <div class="page-head"> <div class="page-title"> <h1> <span>@L("Employees")</span> </h1> </div> </div> </div> </div> <div class="portlet light"> <div class="portlet-body">
<h3>@L("AllEmployees")</h3>
<div class="list-group">
<a href="javascript:;" class="list-group-item" ng-repeat="employee in vm.employees">
<h4 class="list-group-item-heading">
{{employee.name}} {{employee.surname}}
</h4>
<p class="list-group-item-text">
{{employee.emailAddress}}
</p>
</a>
</div>
</div>
</div>
</div>
Whats wrong with it???