ngx-google-places-autocomplete
ngx-google-places-autocomplete copied to clipboard
Options Error - All fields required
When I try to input options it is showing me this error:
Type '{ componentRestrictions: { country: string; }; }' is missing the following properties from type 'Options': bounds, types, fields, strictBounds, origin
17 [options]="{ ~~~~~~~
The error is because in the Options Interface all properties are required. However, I think these should be optional. For example, I want to restrict the country , but I do not want to set bounds, and this is not possible right now, please help. Thank you
Versions "@angular/core": "^12.0.0", "ngx-google-places-autocomplete": "^2.0.5",
you can set to null but i agree that these should be optional.
google docs have these as optional https://developers.google.com/maps/documentation/javascript/reference/places-widget#AutocompleteOptions
HTML <input type="text" ngx-google-places-autocomplete [options]="myOptions">
TS import { Options } from 'ngx-google-places-autocomplete/objects/options/options';
myOptions: any; // class variable
constructor() { this.myOptions = new Options({ componentRestrictions: { country: 'code' } }); // can use any of the restriction(s) }