ngx-google-places-autocomplete icon indicating copy to clipboard operation
ngx-google-places-autocomplete copied to clipboard

reset() not working.

Open fliebenberg opened this issue 5 years ago • 2 comments

I want to reset the value in the input, but when I do it gives an error "InvalidValueError: setTypes not an Array". It does not reset any values on the input (I check the values before and after the reset action and they are the same).

Problem recreated on this StackBlitz. https://stackblitz.com/edit/angular-eczgx5

fliebenberg avatar Apr 20 '20 21:04 fliebenberg

I have the same problem as you and it does seem to be a bug. In the meantime, here is a workaround if needed:

HTML:

<input #addressInput ngx-google-places-autocomplete #placesRef="ngx-places"
          (onAddressChange)="handleAddressChange($event)" />

TS:

import { ElementRef, ViewChild } from '@angular/core';

@ViewChild('addressInput') private addressInput: ElementRef;

public resetInput(): void {
    const input = this.addressInput.nativeElement as HTMLInputElement;
    input.value = '';
}

Mageek627 avatar Aug 14 '20 05:08 Mageek627

hi @fliebenberg , There is an error in your example "ERROR ReferenceError: google is not defined". Probably it can be the root cause of the issue. I don't have such a problem with my local machine

skynet2 avatar Nov 03 '20 14:11 skynet2