google-maps-autocomplete icon indicating copy to clipboard operation
google-maps-autocomplete copied to clipboard

BUG - InvalidValueError: setTypes: not an Array with country="fr"

Open vswom opened this issue 6 years ago • 9 comments

Hello when i use to

<input matInput matGoogleMapsAutocomplete country="fr" placeholder="Vous avez le choix : Code Postal | Ville | Département | Région" (onAutocompleteSelected)="onAutocompleteSelected($event)" (onLocationSelected)="onLocationSelected($event)">

I have a log error navigator : InvalidValueError: setTypes: not an Array

when I take off country="fr" the error disappears.

Thanks for your help

OS and Version?

macOS(Sierra )

Versions

@angular-devkit/architect 0.800.6 @angular-devkit/build-angular 0.800.6 @angular-devkit/build-optimizer 0.800.6 @angular-devkit/build-webpack 0.800.6 @angular-devkit/core 8.0.6 @angular-devkit/schematics 8.0.6 @angular/cdk 8.1.2 @angular/cli 8.0.6 @angular/http 7.2.15 @angular/material 8.1.2 @ngtools/webpack 8.0.6 @schematics/angular 8.0.6 @schematics/update 0.800.6 rxjs 6.4.0 typescript 3.4.5 webpack 4.30.0

vswom avatar Aug 10 '19 14:08 vswom

I have the same issue but with country="co" InvalidValueError: setTypes: not an Array

BrandonAvilanR avatar Aug 21 '19 20:08 BrandonAvilanR

It should have square brackets around country as highlighted in the example [country] = "fr"

The larger issue is that it still does not restrict the suggestions to the specified country. Thats being tracked by Issue #172

dillilabs avatar Aug 23 '19 15:08 dillilabs

here is an example

<input
              (onAutocompleteSelected)="syncAutoComplete($event, this.initialTargetFormGroup, 'property')"
              [placeholder]="'msa.target.property.placeholder' | translate"
              country="de"
              formControlName="property"
              matGoogleMapsAutocomplete
              matInput
              required
            />

and it works fine 👍

AnthonyNahas avatar Aug 27 '19 20:08 AnthonyNahas

Helo, I have the following code: <mat-google-maps-autocomplete #autocompleteStart (onAutocompleteSelected)="onAutocompleteSelectedStart($event)" (onLocationSelected)="onLocationSelectedStart($event)" [appearance]="appearance.OUTLINE" addressLabelText="Inicio" class="autocomplete" country="co"> </mat-google-maps-autocomplete>

I have a log error navigator:

InvalidValueError: setTypes: not an Array

when I take off country="co" the error disappears

OS and Version? macOS( Mojave )

BrandonAvilanR avatar Aug 28 '19 15:08 BrandonAvilanR

Hello,

Thanks for your answer.

i used [country]="['fr']" to make it work.

vswom avatar Sep 02 '19 06:09 vswom

@vswom [country]="['fr']" works and does restrict the filter by country but the InvalidValueError: setTypes: not an Array error still appears.

sdeering avatar Nov 11 '19 00:11 sdeering

The larger issue is that it still does not restrict the suggestions to the specified country. Thats being tracked by Issue #172

By adding [types]="['(regions)']" , it works

ex: <mat-google-maps-autocomplete [types]="['(regions)']" country="ch"></mat-google-maps-autocomplete>

Svkiyo avatar Jul 20 '20 15:07 Svkiyo

By adding [types]="['(regions)']" , it works

The solution posted by @Svkiyo works like a charm

heavybeard avatar Jul 21 '20 12:07 heavybeard

It works but results are in english language whereas previously results were in french language

aat-antoine avatar Aug 10 '21 08:08 aat-antoine