mardi 1 mars 2016

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

Have this code. I want to post the entire object without using separate fields. How I can do this?




Aucun commentaire:

Enregistrer un commentaire