拥有包含此元素的HTML表单:
var control = container.getElementById('AutoComplete');
var input = /** @type {!HTMLInputElement} */ (control);
console.log("input: ", input); //Output: <input type="text" id="AutoComplete" placeholder="--" class="block_input" autocomplete="off">
autocomplete = new google.maps.places.Autocomplete(input, {
types: ['geocode']
});
&#13;
<html>
<div id="input_address">
<div class="element">
<label class="block_label">Адрес</label>
</div>
<div class="element">
<input type="text" id="AutoComplete" placeholder="--" class="block_input"></input>
</div>
</div>
</html>
&#13;
我有一个错误:
不是HTMLInputElement的实例
我该如何解决这个问题?
答案 0 :(得分:0)
只需添加带有自动完成功能的隐藏输入,就可以从控制台中删除它
$scope.showTotal = function() {
$scope.popupTotals = [];
var itemtotal = 0;
for (var i = 0; i < $scope.order.length; i++) {
console.log($scope.order[i]['baseprice']);
itemtotal += parseFloat($scope.order[i]['baseprice']);
// parseFloat will convert string to number and add the number instead of concatenating the strings
}
$scope.popupTotals.push({itembasetotal : itemtotal});
console.log($scope.popupTotals);
$scope.showPopupNow = true;
}
答案 1 :(得分:0)
我遇到了同样的问题,这个方法奏效了。
let searchInputField = document.getElementsByClassName('search-form')[0].getElementsByTagName('input')[0];
let autocomplete = new google.maps.places.Autocomplete(searchInputField);