通过 ng-click AngularJs 从表单中获取所有数据

Get all data from form by ng-click AngularJs

<script src="//ajax.googleapis.com/ajax/libs/angularjs/1.2.12/angular.min.js"></script>
<div ng-app="myApp">
   <div class="container" ng-controller="CtrlList">
      <div class="row">          
          <div ng-repeat="x in users track by $index">
              <div><input type=text  ng-model="x.id"></div>
              <div><input type=text  ng-model="x.title"></div>
              <div><input type=text ng-model="x.completed"></div>                 
          </div>
          <button ng-click="submit(x)">save </button>
      </div>

在控制器中

$scope.submit = function(data){
   console.log(data)  // undefined
}

所以当我点击提交按钮时数据是未定义的..我怎样才能在这里得到表单数据?感谢任何帮助

移动ng-repeat里面的按钮:

  <div class="row">          
      <div ng-repeat="x in users">
          <div><input type=text ng-model="x.id"></div>
          <div><input type=text ng-model="x.title"></div>
          <div><input type=text ng-model="x.completed"></div>                 
          <button ng-click="submit(x)">save </button>
      </div>
  </div>

属性x只在被重复的元素内有效。

要在此处获取数据我们必须通过原始模型.. for ex

      <div ng-repeat="x in users track by $index">
          <div><input type=text  ng-model="x.id"></div>
          <div><input type=text  ng-model="x.title"></div>
          <div><input type=text ng-model="x.completed"></div>                 
      </div>
          <button ng-click="submit(users)">save </button>