【发布时间】:2016-03-01 20:26:42
【问题描述】:
$scope.addMedication = function(med) {
$http.post('/medications', {
name: med.name,
slug: med.slug,
description: med.description
}).success(function(medication) {
$scope.newMedicationTitle = '';
$scope.medications.push(medication);
}).error(function(err) {
// Alert if there's an error
return alert(err.message || "an error occurred");
});
};
有这个代码。我想发布整个对象而不使用单独的字段。我该怎么做?
【问题讨论】:
标签: angularjs post web deployd dpd