angular post 部署方法

angular post method with deployd

$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");
    });
  };

有这个代码。我想 post 整个对象而不使用单独的字段。我该怎么做?

像那样:

$scope.addMedication = function(med) {
    $http.post('/medications', med).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");
    });
  };