Here you go:
HTML file:
<!DOCTYPE html> <html ng-app="myApp"> <head> <meta charset="utf-8" /> <title>AngularJS Plunker</title> <script src="//cdnjs.cloudflare.com/ajax/libs/angular.js/1.3.3/angular.js"></script> <script src="app.js"></script> </head> <body ng-controller="MyController"> <input type="checkbox" ng-model="myCheckbox" ng-change="cbSelected()" /> <input type="text" ng-model="text1" readonly /> <input type="text" ng-model="text2" ng-readonly="!myCheckbox" /> </body> </html>
JS file:
'use strict'; angular.module('myApp', []) .controller('MyController', function($scope) { $scope.text1 = 'some-text'; $scope.cbSelected = function() { if ($scope.myCheckbox) { // when checked $scope.text2 = angular.copy($scope.text1); } else { $scope.text2 = ""; } }; });
See it working here: http://plnkr.co/edit/vURMjLxArLsRSKZj5o9q?p=preview
Ask question & read documentation if have any doubts.