Having some trouble populating a table with JSON data using angular ng-repeat. No errors are showing up in the console, and my breakpoint in the .NET Controller isn't being triggered.
Here's the code for the App Controller:
var app = angular.module('angularTable', []);
app.controller('listdata', function ($scope, $http) {
$scope.contacts = [];
$http({ method: 'GET', url: '/Contacts/GetContacts/' }).success(function (response) {
$scope.contacts = response;
});
});
.NET Controller Code:
[HttpGet]
public JsonResult GetContacts()
{
var data = db.Contacts.Include(x => x.Cities).Include(a => a.Groups);
return Json(data);
}
HTML setup:
<div ng-app ="angularTable">
<table class="table table-hover" ng-controller="listdata">
<thead>
<tr>
<th>Name</th>
<th>Phone</a></th>
<th>Group</th>
<th>City</th>
<th>Actions</th>
</tr>
</thead>
<tbody>
<tr ng-repeat="item in contacts">
<td>{{item.name}}</td>
<td>{{item.area}} {{item.phone}}</td>
<td>{{item.group.description}}</td>
<td>{{item.city.name}}</td>
<td>
<a asp-route-id="{{item.id_Contact}}">Send Message | </a>
<a asp-route-id="{{item.id_Contact}}">Edit | </a>
<a asp-route-id="{{item.id_Contact}}" asp-action="Delete">Delete</a>
</td>
</tr>
</tbody>
</table>
</div>
Using this AngularJS CDN link:
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.5.6/angular.min.js"></script>