Skip to content

Commit 2cf8d4f

Browse files
committed
fix(package): options.push is not a function fixed #104
1 parent f598062 commit 2cf8d4f

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

src/module/component/mat-google-maps-autocomplete.component.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ export class MatGoogleMapsAutocompleteComponent implements OnInit {
8585
ngOnInit(): void {
8686
this.addressValidator.subscribe(this.onNewPlaceResult);
8787

88-
const options: any = {
88+
const options: AutocompleteOptions = {
8989
// types: ['address'],
9090
// componentRestrictions: {country: this.country},
9191
placeIdOnly: this.placeIdOnly,
@@ -95,9 +95,9 @@ export class MatGoogleMapsAutocompleteComponent implements OnInit {
9595
};
9696

9797
// tslint:disable-next-line:no-unused-expression
98-
this.country ? options.push({componentRestrictions: {country: this.country}}) : null;
98+
this.country ? options.componentRestrictions = {country: this.country} : null;
9999
// tslint:disable-next-line:no-unused-expression
100-
this.country ? options.push({types: this.types}) : null;
100+
this.country ? options.types = this.types : null;
101101

102102
this.autoCompleteOptions = Object.assign(this.autoCompleteOptions, options);
103103
this.initGoogleMapsAutocomplete();

src/module/directives/mat-google-maps-autocomplete.directive.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ export class MatGoogleMapsAutocompleteDirective implements OnInit {
6060
ngOnInit(): void {
6161
if (isPlatformBrowser(this.platformId)) {
6262
this.addressValidator.subscribe(this.onNewPlaceResult);
63-
const options: any = {
63+
const options: AutocompleteOptions = {
6464
// types: ['address'],
6565
// componentRestrictions: {country: this.country},
6666
placeIdOnly: this.placeIdOnly,
@@ -70,9 +70,9 @@ export class MatGoogleMapsAutocompleteDirective implements OnInit {
7070
};
7171

7272
// tslint:disable-next-line:no-unused-expression
73-
this.country ? options.push({componentRestrictions: {country: this.country}}) : null;
73+
this.country ? options.componentRestrictions = {country: this.country} : null;
7474
// tslint:disable-next-line:no-unused-expression
75-
this.country ? options.push({types: this.types}) : null;
75+
this.country ? options.types = this.types : null;
7676

7777
this.autoCompleteOptions = Object.assign(this.autoCompleteOptions, options);
7878
this.initGoogleMapsAutocomplete();

0 commit comments

Comments
 (0)