I am new to asp.net mvc with angular and i am unable to add load jquery table.Jquery Datatable showing No data available in table,below is my code
My Controller
app.controller('SpaceController', function ($scope, SpaceService) {
$scope.getAll = function () {
loader(true);
var getData = SpaceService.getAllData();
getData.then(function (response) {
if (response.data.success) {
$scope.listdt = response.data.data;
$('#TblID').DataTable();
$scope.populateStatus();
loader(false);
}
else {
errorAlert("Oops", response.data.message);
loader(false);
}
});
}
})
My Service
app.service("SpaceService", function ($http) {
this.getAllData = function () {
var response = $http({
method: "GET",
url: "/Space/getAll",
dataType: "json"
});
return response;
}
});
My Table html
<table class="table display" id="TblID">
<thead>
<tr>
<th>ID</th>
<th>Key</th>
<th>Name</th>
<th>Description</th>
<th>Status</th>
<th>Action</th>
</tr>
</thead>
<tbody>
<tr ng-repeat="d in listdt">
<td>{{d.SpaceID}}</td>
<td>{{d.SpaceKey}}</td>
<td>{{d.SpaceName}}</td>
<td>{{d.SpaceDesc}}</td>
<td> <span
class="label label-table {{d.StatusKey == 'A' ? 'label-success' : 'label-red'}}">{{d.StatusName}}</span>
</td>
<td>
<a class="btn btn-primary btn-sm" ng-click="edit(d)"><i class="fa fa-pencil fa-lg"></i></a>
<a class="btn btn-danger btn-sm" ng-click="delete(d)"><i class="fa fa-trash fa-lg"></i></a>
</td>
</tr>
</tbody>
</table>
I am unable to find why it is showing No Data,when i try search some thing from table all got rows hide and start showing No data available in table.below is screen shoot.
url: "/Space/getAll"
=> is this a call to MVC controller action? Can you provide example data which returned from that action to verify search box behavior?