对不起这个问题,这可能是一个非常愚蠢的错误。 我很遗憾地看了一会儿,但我无法弄清楚出了什么问题。
app.controller('studentController', function ($scope, db) {
$scope.items = null;
db.getData().then(function (dataResponse) {
$scope.items = dataResponse;
}, function () {
console.log('Shit son');
})
$scope.edit = function () {
$http.post("api/api.php", {
"categorie": $scope.categorie,
"action": "edit",
"id:"
}).success(function (data, status, headers, config) {
console.log("Update success");
});
}
});
我的控制台说错误与成功功能一致。
此致
答案 0 :(得分:1)
对于编辑方法,您的数据不正确。您错过了为id
财产提供的价值。 :
也是属性名称的一部分。试试这个版本。我只是将Id属性的值硬编码为2
$scope.edit = function(){
$http.post("api/api.php",
{ "categorie": $scope.categorie,
"action": "edit",
"id": 2
})
.success(function(data, status, headers, config)
{
console.log("Update success");
});
};
答案 1 :(得分:1)
缺少参数ID的值:
"id:"
应该是
"id": someValue