Skip to content

Commit

Permalink
fix(package): prevent invalid value error when type or country are null
Browse files Browse the repository at this point in the history
  • Loading branch information
AnthonyNahas committed May 4, 2019
1 parent 93e1d68 commit 80014cd
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
11 changes: 8 additions & 3 deletions src/module/component/mat-google-maps-autocomplete.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
};

Expand Down

0 comments on commit 80014cd

Please sign in to comment.