There is a table whose data is drawn from the server.
In each row of this table there is a button to delete this row (one entry in the table, or rather not an deletion, but an update)
So when I click the delete button, the request goes to the server that updates the field.
How to update view
[ { id: 11, name: 'csdacdcdc' }, { id: 12, name: 'dvSDSvbf' } ] that is, after the update, now you need to display all data except the object with id: 11.
I wanted to know in Angulyar there is some kind of ready-made way, or do it manually
The data in the table output through ng-repeat
Markup
<table class="table table-striped table-bordered table-tours"> <thead> <tr> <th>Номер</th> <th>Название</th> <th>Город</th> <th>Тип</th> <th>Дата начала</th> <th>Количество дней</th> <th>Опубликовано</th> <th></th> </tr> </thead> <tbody> <tr ng-repeat="tour in tours | filter: query"> <td ng-bind="$index+1"></td> <td><a ng-bind="tour.name" href="admin/tour/edit/{{tour.id}}"></a></td> <td ng-bind="tour.town.name"></td> <td ng-bind="tour.tours_type.name"></td> <td ng-bind="tour.date_start | date">Trident</td> <td>Trident</td> <td> <switcher class="styled" ng-model="tour.published" ng-disabled="isDisabled" ng-change="onChangePublish(newValue, oldValue, tour.id)" true-label="" false-label=""> </switcher> </td> <td><button class="btn btn-danger" ng-click="removeTour(tour.id)"> <i class="fa fa-trash"></i></button> </td> </tr> </tbody> </table> Controller
$scope.removeTour = function(tour_id){ $http({ url: "/tour/update-tour", method: "POST", data: { id: tour_id, removed: 1 } }).success(function (data) { $scope.init(); }).error(function (data, status, headers, config) { $scope.status = status; }); }