ng-model 不会更新更改后的表单内容

ng-model won't update the changed form content

我有一个表单,其中有一个删除条目按钮和一个添加条目按钮。我想将更新后的表单域数据输出到formData={},这样提交的数据就会是最新的。但是,当删除字段集时,formData={} 不会更新为最新的数据条目信息,旧的表单数据仍然存在于 formData={} 中。 Here's the link for my code

这样试试。

var app = angular.module("app",[]);

app.controller("MyCtrl" , function(){
  var formCtrl = this;
   formCtrl.forms ={
       formData:[{ name:""}]
   };
  
  formCtrl.addFields = function(){
    var name = {name:""};
     formCtrl.forms.formData.splice(formCtrl.forms.formData.length,0,name);
        
    };
  
  formCtrl.rmFields = function(form){
    var index  = formCtrl.forms.formData.indexOf(form);
       formCtrl.forms.formData.splice(index,1);
    }
  
  });
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.2.23/angular.min.js"></script>
<div ng-app="app" ng-controller="MyCtrl as formCtrl">
   <table>
     <tr ng-repeat="form in formCtrl.forms.formData">
        <td> <input type="text" ng-model="form.name"></td>
        <td> <input type="button" ng-click="formCtrl.addFields()" value="Add" ng-show="$last"></td>
        <td> <input type="button" ng-click="formCtrl.rmFields(form)" value="Delete" ng-show="$index != 0"></td>
     </tr>
   </table> 
    <span>  <pre>{{formCtrl.forms | json }}</pre></span>
</div>