大家好我想获取从输入值Buyer_name
到Copied Buyer_name
输入field.i尝试过很多方法,但无法找到解决办法,如果有人知道的解决方案,请帮助我....我普拉克
控制器:-
$('#supname').change(function() {
$('#supnamecopy').val($(this).val());
});
HTML:
<label for="quantity">Quantity</label>
<input type="text" ng-model="state.quantity" id="quantity" typeahead="state as state.quantity for state in states | filter: $viewValue">
<label for="quantity">Buyer_name</label>
<input type="text" id="supname" ng-model="state.quantity" typeahead="state.buyer_name for state in states | filter: $viewValue">
<label for="quantitycopy">Copied Buyer_name</label>
<input type="text" name="supnamecopy" id="supnamecopy" ng-model="copied">
我的数据:
$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-保持原样
JS-将jQuery更改为角度功能。
目前设置ng模型的方式将$ scope.state.quantity分配为选定状态,而不是该状态的数量值。
$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;
}
});
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句