AngularJS не обновляется таблица. Нужна помощь
<table class="table table-bordered table-striped">
<thead>
<tr>
<th>
<a href="#" ng-click="orderByField='id'; reverseSort = !reverseSort">
ID
<span ng-show="orderByField == 'id'">
<span ng-show="!reverseSort" class="fa fa-caret-up"></span>
<span ng-show="reverseSort" class="fa fa-caret-down"></span>
</span>
</a>
</th>
<th>
<a href="#" ng-click="orderByField='name'; reverseSort = !reverseSort">
Name
<span ng-show="orderByField == 'name'">
<span ng-show="!reverseSort" class="fa fa-caret-up"></span>
<span ng-show="reverseSort" class="fa fa-caret-down"></span>
</span>
</a>
</th>
<th>
<a href="#" ng-click="orderByField='desiredResolutionDateString'; reverseSort = !reverseSort">
Desired Date
<span ng-show="orderByField == 'desiredResolutionDateString'">
<span ng-show="!reverseSort" class="fa fa-caret-up"></span>
<span ng-show="reverseSort" class="fa fa-caret-down"></span>
</span>
</a>
</th>
<th>
<a href="#" ng-click="orderByField='urgency'; reverseSort = !reverseSort">
Urgency
<span ng-show="orderByField == 'urgency'">
<span ng-show="!reverseSort" class="fa fa-caret-up"></span>
<span ng-show="reverseSort" class="fa fa-caret-down"></span>
</span>
</a>
</th>
<th>
<a href="#" ng-click="orderByField='state'; reverseSort = !reverseSort">
Status
<span ng-show="orderByField == 'state'">
<span ng-show="!reverseSort" class="fa fa-caret-up"></span>
<span ng-show="reverseSort" class="fa fa-caret-down"></span>
</span>
</a>
</th>
<th>Action</th>
</tr>
</thead>
<tbody id="myTable" ng-repeat="ticket in ctrl.tickets|orderBy:orderByField:reverseSort" >
<tr>
<td><span ng-bind="ticket.id"></span></td>
<td>
<a type="button" class="btn btn-link" ng-click="ctrl.overview(ticket.id)">
<span ng-bind="ticket.name"></span>
</a>
</td>
<td><span ng-bind="ticket.desiredResolutionDateString"></span></td>
<td><span ng-bind="ticket.urgencyName"></span></td>
<td><span ng-bind="ticket.stateName"></span></td>
<td>
<div class="btn-group">
<button type="button" class="btn btn-primary dropdown-toggle" data-toggle="dropdown"> Sony
<span class="caret"></span>
</button>
<ul class="dropdown-menu" role="menu">
<li><a href="#">Tablet</a></li>
<li><a href="#">Smartphone</a></li>
</ul>
</div>
</td>
</tr>
</tbody>
</table>
self.tickets = [];
self.getAllTickets = fetchAllTickets;
self.getMyTickets = getMyTickets;
/* fetchAllTickets();*/
getMyTickets();
function fetchAllTickets() {
TicketService.fetchAllTickets()
.then(
function (d) {
self.tickets = d;
},
function (errResponse) {
console.error('Error while fetching Tickets');
}
);
}
function getMyTickets() {
TicketService.getMyTickets()
.then(
function (d) {
self.tickets = d;
},
function (errResponse) {
console.error('Error while fetching Tickets');
}
);
}
две кнопки. одна вызывает getMyTickets другая fetchAllTickets.
не обновляется таблица. данные с сервера приходят. в переменную tickets записываются. В чем может быть причина?
|