Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Options Error - All fields required #97

Open
franzbascope opened this issue Oct 11, 2021 · 2 comments
Open

Options Error - All fields required #97

franzbascope opened this issue Oct 11, 2021 · 2 comments

Comments

@franzbascope
Copy link

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",

@finitekaren
Copy link

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

@mayurgudi
Copy link

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)
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants