【发布时间】:2016-09-07 13:48:42
【问题描述】:
HTML
当我尝试删除一些数据时,我在控制台中得到这个:当我尝试删除一些数据时,我在控制台中得到这个:当我尝试删除一些数据时,我在控制台中得到这个:当我尝试删除时我在控制台中得到了一些数据:
DELETE https://sails-backoffice.herokuapp.com/api/todo/:id 404 (Not Found)
有什么想法吗?
<tbody>
<tr ng-repeat="todo in listTodo">
<td>{{$index}}</td>
<td>{{todo.id}}</td>
<td>{{todo.titre}}</td>
<td ng-class="{'completed': todo.completed == true}"><a href="/message-details/{{todo.id}}">{{todo.message}}</a></td>
<!--<td><button type="button" class="btn btn-primary">Ajouter</button></td>-->
<td><button type="button" class="btn btn-danger" ng-click="delete(todo.id)">Supprimer</button></td>
</tr>
</tbody>
控制器
angular.module('crud')
.controller('TodoCtrl', function ($scope,$routeParams,Todolist,$http,Todo) {
$scope.delete=function(id){
var removed=Todo.removeTodo(id);
removed.success(function (data, status, headers, jwr) {
$scope.listTodo=data;
})
.error(function (data, status, headers, jwr) {
console.log(data);
});
}; });
服务
angular.module('crud')
.service('Todo', function ($http) {
removeTodo:function(id){
return $http.delete('https://sails-backoffice.herokuapp.com/api/todo/:id',id);
},
});
【问题讨论】:
标签: angularjs node.js http sails.js