I have two input boxes.one for current address and another for permanant.
When I click on checkbox,current address value should be display on permanant address.
Similarly when I uncheck permanantAddress should be empty.But its not working.what I did wrong here?
var app=angular.module('myApp',[]) app.controller('myController',function($scope){ $scope.init = function(){ $('.sameAddress').change(function () {debugger if ($(this).prop('checked')) { $scope.data.permanantAddress = $scope.data.address; } }) } }) <script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script> <script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.2.23/angular.min.js"></script> <div ng-app="myApp" ng-controller="myController" ng-init="init()"> <form id="myForm" > <div> <input type="text" ng-model="data.address"> </div> <div><input type="checkbox" class="sameAddress"/><span>Permanant Address same as Current Address</span></div> <div> <input type="text" ng-model="data.permanantAddress"> </div> </form> </div>