html - How to fetch value from one input into another? -


hi want fetch input value buyer_name copied buyer_name input field.i tried many ways unable find solution if knows solution please me....my plunk

controller:-

$('#supname').change(function() { $('#supnamecopy').val($(this).val());  }); 

html:-

 <label for="quantity">quantity</label>       <input type="text" ng-model="state.quantity" id="quantity" typeahead="state state.quantity state in states | filter: $viewvalue">   <label for="quantity">buyer_name</label>       <input type="text" id="supname" ng-model="state.quantity" typeahead="state.buyer_name  state in states | filter: $viewvalue">   <label for="quantitycopy">copied buyer_name</label>       <input type="text" name="supnamecopy" id="supnamecopy" ng-model="copied"> 

my data:-

    $scope.states = [{ "_id": "5744009c2f0f2bef0ca707ef", "user": { "_id": "57400c32bd07906c1308e2cf", "displayname": "mani selvam" }, "description_count": "check", "description_quality": "new", "__v": 1, "created": "2016-05-24t07:19:56.471z", "cone": "pending", "status": "pending", "currency": "rs", "unit": "kg", "price": [ "500", "400" ], "actual_devlivery_date": "2016-05-2", "ex_india_date": "2016-05-24", "quantity_unit": "kg", "quantity": "34", "enquiry_received_date": "2016-05-24", "supplier_name": "mani selvam", "buyer_name": "rohit" }, 

http://plnkr.co/edit/vizkym08ikuschl5vvol?p=preview

html - remains is

js - changed jquery angular functionality.

the way ng-model set @ moment assigns $scope.state.quantity selected state rather quantity value state.

$scope.$watch('state.quantity', function() {     if($scope.state && $scope.state.quantity && $scope.state.quantity.buyer_name) {         $scope.copied = angular.copy($scope.state.quantity.buyer_name);     } else {         $scope.copied = null;     } }); 

Comments

Popular posts from this blog

sql - invalid in the select list because it is not contained in either an aggregate function -

Angularjs unit testing - ng-disabled not working when adding text to textarea -

How to start daemon on android by adb -