ionic 表单序列化


引入服务对象:

app.controller('registerCtrl',['$scope','$kflHttp','$httpParamSerializerJQLike','$ionicModal',function($scope,$kflHttp,$httpParamSerializerJQLike,$ionicModal){

  $scope.userInfo = {}; //初始化,重要
  
  $scope.clickRegister = function(){
    console.log($scope.userInfo);
    var result = $httpParamSerializerJQLike($scope.userInfo);
    console.log(result);
  }

}]);

html:
<label class="item item-input item-floating-label">
  <span class="" name="userName">昵称/手机号/邮箱span>

  <input ng-model="userInfo.name" type="text" placeholder="Your name"/>
label>
<label class="item item-input item-floating-label">
  <span class="">请输入密码span>

  <input ng-model="userInfo.pwd" type="text" placeholder="Your password"/>
label>
<label class="item item-input item-floating-label">
  <span class="">请确认密码span>

  <input ng-model="userInfo.confirmPwd" type="text" placeholder="password confirm"/>
label>


你可能感兴趣的:(ionic 表单序列化)