第一个输入字段
<input type="text" id="prmnt_a1" ng-model="prmnt_a1" class="customInput" placeholder="Address Line 1"/>
复选框
<input type="checkbox" id="same" ng-model="same" ng-change="stateChanged(same)"/>
第二个输入
<input type="text" id="prmnt_a2" ng-model="prmnt_a2" class="customInput" placeholder="Address Line 2"/>
如果复选框为 true,则第一个输入值应反射(reflect)到第二个输入字段。
最佳答案
尝试这个 Angular 代码
$scope.stateChanged = function(same){
if(same == true){
$scope.prmnt_a2 = $scope.prmnt_a1;
}else {
$scope.prmnt_a2 = '';
}
}
关于jquery - 有条件地将第一个输入值反射(reflect)到第二个输入字段(基于复选框),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/36687147/