I'm trying to refresh the html table data for every ten seconds by invoking GetTicketDetails method using $interval service, but my view is not reflecting the changes. Below is my Java Script Code section for binding data:
$scope.GetTicketDetails = function () {
$http.get(CMSRestServiceURL+"getalltickets")
.success(function (response) {
$scope.ticketdetails = response;
});
};
Below is $interval code:
$interval(function () {
$scope.GetTicketDetails();
}, 10000);
Below is my html:
<table id="tblticketdetails" class="table table-condensed table-bordered ticketdetailstablestyle">
<thead>
<tr>
<th class="tableheadingstyle">Ticket ID</th>
<th class="tableheadingstyle">Created DateTime</th>
<th class="tableheadingstyle">Customer ID</th>
<th class="tableheadingstyle">Subject</th>
<th class="tableheadingstyle">Description</th>
<th class="tableheadingstyle">Status</th>
<th class="tableheadingstyle">Edit Ticket</th>
</tr>
</thead>
<tbody class="searchable">
<tr ng-repeat="ticket in ticketdetails">
<td>{{ ticket.TicketID }}</td>
<td>{{ ticket.CreatedDateTime }}</td>
<td>{{ ticket.CustomerID }}</td>
<td>{{ ticket.Subject }}</td>
<td>{{ ticket.Description }}</td>
<td ng-switch on="ticket.Status">
<span class="labelstatus label-danger" ng-switch-when="open">Open</span>
<span class="labelstatus label-info" ng-switch-when="pending">Pending</span>
<span class="labelstatus label-primary" ng-switch-when="work in progres">Work in Progress</span>
<span class="labelstatus label-success" ng-switch-when="resolved">Resolved</span>
<span class="labelstatus label-warning" ng-switch-when="not resolved">Not Resolved</span>
<span class="labelstatus label-warning" ng-switch-when="violated">Violated</span>
</td>
<td>
<button class="btnEdit btn-warning" ng-click="Edit(ticket)">Edit</button>
</td>
</tr>
</tbody>
</table>
I've tried $scope.$apply() and $scope.$digest(). But after that also, the changes didn't reflect in my view. Any help is appreciated. Thanks in advance.