Angular - Input1 Value Input2 same value when Checkbox is checked

后端 未结 3 659
忘掉有多难
忘掉有多难 2021-01-25 11:26

i have a problem, Here my code

3条回答
  •  自闭症患者
    2021-01-25 12:12

    You should use $scope.$watch to keep a look on the $scope.check variable. Once user click the checkbox, watchCheck would be invoked. Since you have defined the ng-true-value as "Yes", you have to check the checked ==== 'Yes' when the $scope.check changes.

    $scope.$watch('check', function watchCheck(checked) {
        if (checked === 'Yes') {
            $scope.nama1=$scope.nama;
            $scope.telephone1=$scope.telephone;
        }
    });
    

提交回复
热议问题