Skip to content

Commit 8ebe3fb

Browse files
committed
fix(package): prevent invalid value error for the directive as well #100
1 parent 9281882 commit 8ebe3fb

File tree

3 files changed

+11
-6
lines changed

3 files changed

+11
-6
lines changed

package-lock.json

Lines changed: 3 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@
114114
"tslint": "^5.14.0",
115115
"typescript": "~3.2.4",
116116
"webpack": "^4.29.6",
117-
"webpack-cli": "^3.3.0",
117+
"webpack-cli": "^3.3.2",
118118
"webpack-node-externals": "^1.7.2",
119119
"yargs": "^12.0.5",
120120
"zone.js": "^0.8.27"

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

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

72+
// tslint:disable-next-line:no-unused-expression
73+
this.country ? options.push({componentRestrictions: {country: this.country}}) : null;
74+
// tslint:disable-next-line:no-unused-expression
75+
this.country ? options.push({types: this.types}) : null;
76+
7277
this.autoCompleteOptions = Object.assign(this.autoCompleteOptions, options);
7378
this.initGoogleMapsAutocomplete();
7479
}

0 commit comments

Comments
 (0)