所以这是一个JSFiddle example
Everithing很简单。但是,如何从自动完成表单中获取直接输入文本?整个文字值?
如果您致电.getPlace()
,您会收到结构化信息,但我需要在用户输入时从输入字段中获取相同的文字。
var place = tbgeo.getPlace();
// How to get something like this => var userinput = tbgeo.InnerText;
console.log(JSON.stringify(place));
var lat = place.geometry["location"]["k"]
var lng = place.geometry["location"]["D"]
var address = '';
if (place.address_components) {
address = [
(place.address_components[0] && place.address_components[0].short_name || ''),
(place.address_components[1] && place.address_components[1].short_name || ''),
(place.address_components[2] && place.address_components[2].short_name || '')
].join(' ');
}
答案 0 :(得分:0)
你可以这样做,
<div ng-app="">
<p>Name: <input type="text" ng-model="userInputText" ></p>
Bind Name: <input type="text" ng-model="userInputText" >
<!-- or use ng-bind instead of ng-model -->
<p ng-bind="userInputText"></p>
</div>