3

Hi i have a zipcode field when user enters a 5/9 digit zip it should auto populate the State and city fields.

here i placed the code

<div class="form-group">
<label class="control-label col-sm-2" for="state">State</label>
<div class="col-sm-4">
<div class="select-holder wid100">
<select id="state"><option></option></select>
</div>
</div>
</div>
<div class="form-group">
<label class="control-label col-sm-2" for="city">City</label>
<div class="col-sm-4">
<div class="select-holder wid100">
<select id="city"><option></option></select>

</div>
</div>
</div>
<div class="form-group">
<label class="control-label col-sm-2" for="ZC">Zip Code</label>
<div class="col-sm-4">
<input type="text" class="form-control" id="ZC" name="zipcode" ng-pattern="patternzipcode" ng-model="zipcode" placeholder="" type="text" maxlength="14" required placeholder="">
</div>
<div class="white-alert" ng-show="myForm.zipcode.$dirty && myForm.zipcode.$invalid">
<span ng-show="myForm.zipcode.$error.required">Contact Number is required.</span>
<span ng-show="myForm.zipcode.$error.pattern">US zipcodes should be formatted as 5 digits(12345) or the 5+4 (12345-1234)format</span>
</div>
</div>

Referred in Lookup City and State by Zip Google Geocode Api

Still confusing. How to retrieve in angular.

Can anyone please help on this?

Thanks

Community
  • 1
  • 1
Idris
  • 281
  • 2
  • 6
  • 16

0 Answers0