AngularJS: code not working when iterating through object [duplicate]
问题 This question already has answers here : 'this' vs $scope in AngularJS controllers (7 answers) Closed 3 years ago . I am trying to populate a list of employee objects from my controller empctrl in a template. Here's the controller: app.controller('employeeController', function ($scope, employeeService) { this.employees = {}; this.populateTable = function (data) { this.employees = data; }; var error = function (err) { console.log("Error: " + err); }; // Call Service to List all Employees