我有两个离子标签,每个都有不同的形式。我想在移动到第二个标签时设置第二个标签字段值(模态)。
$scope.familyDetailsObj = {
"familyDetils": {
"fatherNm":""
}
}
点击“继续”btn时,我按以下方式传递值
$scope.continueBtn = function(tabindex){
if(tabindex == 1){
$scope.familyDetailsObj.familyDetils.fatherNm = "xyz";
CustomerService.setFamilyDetails($scope.familyDetailsObj);
$scope.og = CustomerService.getFamilyDetails();
console.log($scope.og.familyDetils.fatherNm); //xyz
$scope.familyDetailsObj.familyDetils.fatherNm = $scope.og.familyDetils.fatherNm;
}
.factory('CustomerService', ['$rootScope', function ($rootScope) {
var familyDetails = {}
return{
setFamilyDetails : function(familyDetailsObj){
familyDetails = familyDetailsObj;
},
getFamilyDetails : function(){
return familyDetails;
}
};
}])
第二个选项卡中的<input type="text" data-ng-model="familyDetailsObj.familyDetils.fatherNm" name="fatherNm">
我已在codepen中更新了http://codepen.io/anon/pen/KVPNWJ
点击继续按钮后,未设置模型值。