我正在使用离子3,我想获得输入并使用谷歌地图添加一些自动完成。我的.ts文件中有以下警报。
let alert = this.alertCtrl.create({
title: 'Offer a Ride',
inputs: [
{
name: 'From',
placeholder: 'From',
id: 'From'
},
{
name: 'To',
placeholder: 'To',
type: 'text',
id: 'To'
},
{
name: 'Date',
placeholder: 'Date',
type: 'date'
}
],
buttons: [
{
text: 'Cancel',
role: 'cancel',
handler: data => {
console.log('Cancel clicked');
elem.style.filter='none';
}
},
{
text: 'Offer',
handler: data => {
elem.style.filter='none';
var from = data.From;
var to = data.To;
//this.navCtrl.setRoot (TabsPage, {from:from, to:to});
let toast = this.toastCtrl.create({
message: 'Location was set Successfully',
duration: 3000
});
toast.present();
}
}
]
});
我想做以下事情:
var autocomplete;
autocomplete = new google.maps.places.Autocomplete(
(document.getElementById('From')),
{types: ['geocode']});
但是,我无法获得id'From'的输入。知道怎么做吗?