diff --git a/src/module/component/mat-google-maps-autocomplete.component.ts b/src/module/component/mat-google-maps-autocomplete.component.ts index 628efddd..97c3a366 100644 --- a/src/module/component/mat-google-maps-autocomplete.component.ts +++ b/src/module/component/mat-google-maps-autocomplete.component.ts @@ -85,15 +85,20 @@ export class MatGoogleMapsAutocompleteComponent implements OnInit { ngOnInit(): void { this.addressValidator.subscribe(this.onNewPlaceResult); - const options = { + const options: any = { // types: ['address'], - componentRestrictions: {country: this.country}, + // componentRestrictions: {country: this.country}, placeIdOnly: this.placeIdOnly, strictBounds: this.strictBounds, - types: this.types, + // types: this.types, type: this.type }; + // tslint:disable-next-line:no-unused-expression + this.country ? options.push({componentRestrictions: {country: this.country}}) : null; + // tslint:disable-next-line:no-unused-expression + this.country ? options.push({types: this.types}) : null; + this.autoCompleteOptions = Object.assign(this.autoCompleteOptions, options); this.initGoogleMapsAutocomplete(); } diff --git a/src/module/directives/mat-google-maps-autocomplete.directive.ts b/src/module/directives/mat-google-maps-autocomplete.directive.ts index a6fd8e23..6157cfec 100644 --- a/src/module/directives/mat-google-maps-autocomplete.directive.ts +++ b/src/module/directives/mat-google-maps-autocomplete.directive.ts @@ -65,7 +65,7 @@ export class MatGoogleMapsAutocompleteDirective implements OnInit { componentRestrictions: {country: this.country}, placeIdOnly: this.placeIdOnly, strictBounds: this.strictBounds, - types: this.types, + // types: this.types, type: this.type };