Angularjs:要从Zip输入自动填充城市和州,需要帮助进行整合

时间:2016-11-29 12:02:48

标签: javascript jquery angularjs web-services google-api

嗨我有一个邮政编码字段,当用户输入一个5/9数字的拉链时,它应自动填充州和城市字段。

这里我放置了代码

<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>

参考Lookup City and State by Zip Google Geocode Api

仍然令人困惑。如何以角度检索。

有人可以帮忙吗?

由于

0 个答案:

没有答案