如何在前端将配方中的成分拼接起来,然后单击“更新”,配方中的成分将在数据库中删除?

时间:2018-11-19 06:17:04

标签: angularjs spring rest spring-data-jpa

现在我在春季项目中遇到了一个问题,我想在前端更新我的食谱。例如this is the example output of Update Recipe,我已经显示了食谱的详细信息,我想删除其中的一种成分,然后对其进行更新。那我该怎么办呢?

我尝试使用拼接方法拼接成分,然后单击“更新”以运行PUT服务,但是该成分并未从数据库中删除。

这是我的一部分源代码,我该怎么做?

       $scope.selectRecipe = function(recipe) {
         $scope.selectedRecipe = recipe;
         }

      $scope.deleteIngredient = function(index) {
            $scope.selectedRecipe.ingredients.splice(index, 1);
        }

          $scope.updateRecipe = function() {
    RecipeList.putRecipe($scope.selectedRecipe, function(err,data) {
      if(!err)
      {
            $scope.msg ="success";
      }

            });

0 个答案:

没有答案
相关问题