i trying combine 3 inputs of input text , binding data input text.
<input type="text" class="textbox" name="country" id="loc_country" value="gershon" ng-model="location.country"/> <input type="text" class="textbox" name="city" id="loc_city" ng-model="location.city"/> <input type="text" class="textbox" name="street" id="loc_street" autocomplete="off" ng-model="location.street"/> <input type="text" class="textbox" name="result" id="result"/> here first 3 inputs need added 4 input automatically binding
you should set value html attribute of text box. can inline so:
<input type="text" class="textbox" name="result" id="result" value="{{location.street + ' ' + location.city + ' ' + location.country}}"/> or can use computed property. here example:
html:
<div ng-app> <div ng-controller="somectrl"> <input ng-model="textproperty"/> <input value="{{getcalculatedtext()}}"/> </div> </div> js:
function somectrl($scope) { $scope.textproperty = "some text"; $scope.getcalculatedtext = function() { return $scope.textproperty+ " calculated";}; }
Comments
Post a Comment