digipolisantwerp / location-picker_widget_angular

Antwerp UI Location Picker Widget UI (Angular)
Other
2 stars 6 forks source link

locationSelect does not return value #17

Open QuintenGeoSolutions opened 4 years ago

QuintenGeoSolutions commented 4 years ago

Issue: when using the locationPickerWidget, upon selecting an address, the bar does not get the selected value and the event locationSelect does not fire.

Expected: the event locationSelect fires when n address is selected from the dropdown, or when an address is found after pressing enter.

using:

Florian-Ramakers commented 4 years ago

hmmm that's not supposed to happen. I'll take a look and let you know when it's fixed!

Florian-Ramakers commented 4 years ago

I did a little research and the locationSelect event should be firing when showMap is set to false. The locationSelect event emits the value of the current selected value (by clicking or pressing enter when results where found)

(locationSelect)="myOnChangeFunction($event)" => $event contains the selected value.

Can you verify if it works when using an ngModel or a reactiveFormControl? Note: you can only use one of the provided options at a time for getting a value.

minan61 commented 4 years ago

Hi Florian The issue is that we use changeDetection: ChangeDetectionStrategy.OnPush as strategy for angular. This prevents the onclick event in the locationpicker dropdown to be fired. Pressing enter works as designed but click doesn;t work with this strategy

import { ChangeDetectionStrategy} from '@angular/core';

@Component({ selector: 'app-toolbar', templateUrl: './toolbar.component.html', styleUrls: ['./toolbar.component.scss'], changeDetection: ChangeDetectionStrategy.OnPush })

Can you reproduce this problem?