Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
192 views
in Technique[技术] by (71.8m points)

javascript - 为什么我不能在Google Map上使用Ionic 4输入字段(Why I cannot use ionic 4 input field with google map)

I want to use the ionic input with google map but it gives me an error :

(我想在Google地图上使用离子输入,但它给我一个错误:)

InvalidValueError: not an instance of HTMLInputElement

Here's the code :

(这是代码:)

HTML:

(HTML:)

<ion-item>
  <ion-label position="floating">Destination</ion-label>
  <ion-input #autoCompleteInputDestination formControlName="destination"></ion-input>
</ion-item>

ts file :

(ts文件:)

@ViewChild('autoCompleteInputDestination', {static: true}) inputNativeElementd: any;

// destination
const autocomplete2 = new google.maps.places.Autocomplete(
    this.inputNativeElementd.nativeElement as HTMLInputElement
);
autocomplete2.addListener('place_changed', () => {
    //some code
});

Any suggestions for this problem?

(对这个问题有什么建议吗?)

  ask by just aname translate from so

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)
等待大神答复

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...