I have a Json file that I would like to output into a table. I am using $http.get request and $q to retrieve Json object. I am trying to figure out how to get that data into a table that will display on the page. Any advice will help
AngularJS
var app = angular.module('AdminUsers', []);
app.controller("PeopleCtrl", function ($scope, $http, $q) {
$scope.AdminUserSettings = {
dataSource: new data.dataSource({
load: function () {
var def = $.Deferred();
$http({
method: 'GET',
url: '//This is where my localhost:xxxx/api/ is going'
}).success(function (data) {
def.resolve(data);
});
return def.promise();
}
})
}
})
HTML
<div ng-app="myApp">
<div ng-controller="PeopleCtrl">
<table>
<tr>
<th>ID</th>
<th>UserName</th>
<th>UserRoleID</th>
</tr>
<tr ng-repeat="person in AdminUser">
<td>{{person.ID}}</td>
<td>{{person.UserName}}</td>
<td>{{person.UserRoleID}}</td>
</tr>
</table>
</div>
</div>
JSON
[{"ID":5,"UserName":"JohnSmith","UserRoleID":1},{"ID":7,"UserName":"BobBrown","UserRoleID":3}...etc.]
PeopleCtrl
, since that's what you are using to output the table? Where isAdminUser
defined? – Kevin B yesterday