Reputation: 153
I'm trying to send the "$event" that '(onLocationSelected)' returns as an argument in the 'searchInputChanged' function on (change). Any idea on how to do this, or an alternative? Thanks]1
Note: 'onAutoComplete' is part of the 'matGoogleMapsAutocomplete' dependencie.
<input matInput
matGoogleMapsAutocomplete
country="PR"
placeholder="Search for location" type="address"
formControlName="firstCtrl"
(onAutocompleteSelected)="onAutocompleteSelected($event)"
(onLocationSelected)="onLocationSelected($event)"
(change)="searchInputChanged(onLocationSelected $event)"
required>
Upvotes: 0
Views: 124
Reputation: 489
in your onAutocompleteSelected method, save the value of your event to a property in your component, then have searchInputChanged access that property.
in your component....
onAutocompleteSelected(event) {
// do whatever
this.autocompleteEvent = event
}
searchInputChanged() {
// use this.autocompleteEvent instead of passing a parameter
}
Upvotes: 2