AngularJS 1.6.x
In the controller I write:
var Vehicle = $resource(prfx+'vehicles/:Id', {Id:'@id'}); var vehicles = Vehicle.query( function(){ $scope.list = vehicles; $scope.selected = [vehicles[vehicles.length-1]]; } ); The choice of an element for editing did this:
<select ng-model="selected"> <option ng-repeat="option in list | orderBy:'id' track by option.id" ng-value="option"> #{{option.id}} {{option.title}}</option> </select> In the template you want to write simple buttons
<form ng-repeat="option in selected " ng-submit="option.$save()" > формочки <button type="submit">Сохранить</button> <button type="button" ng-click="option.$delete()">Удалить</button> </form> The DELETE method is executed on the server and it seems that the resource can be deleted from the model. But he does not delete himself.
Do I need to add my delete handler or can I call this method so that everything works?