I have two forms in different tabs and i am storing the values in one common JSON object.
Now i am able to getting the first tab form values. If i click on the second tab 'continue' button, the values of the first tabbed form values getting blank.
controller.js
$scope.custDetailsObj = {
"personalDetails":{
"firstname":"",
"lastname":""
},
"Idproof":{
"idtype": "",
"idnum": "",
"doi": ""
}
};
$scope.continueBtn = function(){
console.log($scope.custDetailsObj);
$ionicTabsDelegate.select(1);
};
Firt tab content
<label class="item item-input">
<span class="input-label">First Name:</span>
<input type="text" data-ng-model="custDetailsObj.personalDetails.firstname" name="firstname" />
</label>
<label class="item item-input">
<span class="input-label">Last Name:</span>
<input type="text" data-ng-model="custDetailsObj.personalDetails.lastname" name="lastname">
</label>
<button type="submit" class="button button-full button-positive" ng-click="continueBtn()">Continue</button>
Second tab content
<label class="item item-input">
<span class="input-label">ID Type:</span>
<input type="text" value="" data-ng-model="custDetailsObj.Idproof.idtype" name="idtype"/>
</label>
<label class="item item-input">
<span class="input-label">ID Number:</span>
<input type="text" value="" data-ng-model="custDetailsObj.Idproof.idnum" name="idnum"/>
</label>
<button type="submit" class="button button-full button-positive" ng-click="continueBtn()">Continue</button>