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

The Directive doesn't accept dynamic options #48

Closed
Andrii-A opened this issue Sep 18, 2019 · 3 comments
Closed

The Directive doesn't accept dynamic options #48

Andrii-A opened this issue Sep 18, 2019 · 3 comments

Comments

@Andrii-A
Copy link

Hello,

I would like to use the directive with an options object and change some params based on user input in runtime.

I found that the directives accepts options only once - when I change the options object, directive doesn't know about it.

Is it known issue?

thanks.


HTML:

<input type="text" matInput placeholder="Primary Address" formControlName="primaryAddressFormControl"
ngx-google-places-autocomplete
[options]="placesAutocompleteOptions" (onAddressChange)="handleAddressChange($event)"/>


TS:

// onInit
this.placesAutocompleteOptions = {
types: [ '(cities)' ],
componentRestrictions: { country: 'us'}
};

// when user selects new country in dropdown
handleCountryChange($event) {
this.placesAutocompleteOptions.componentRestrictions.country = $event;
}

@Mafandv
Copy link

Mafandv commented Sep 19, 2019

#33

https://github.com/skynet2/ngx-google-places-autocomplete/blob/master/example/app/app.component.ts#L51

@Andrii-A Andrii-A changed the title The Directive doesn't accept dymamic options The Directive doesn't accept dynamic options Sep 19, 2019
@Andrii-A
Copy link
Author

ref.reset() helped, thank you!

@KBeDevel
Copy link

This example should be documented/referenced in the README

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