Skip to content

Commit 64e3243

Browse files
Merge pull request #50 from digipolisantwerp/feature/GIS-513
Adds option for adding coordinate to results list
2 parents ed5950a + dd277eb commit 64e3243

File tree

3 files changed

+10
-0
lines changed

3 files changed

+10
-0
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ All notable changes to this project will be documented in this file.
99

1010
### Added
1111
- Added actualLocation property to tempLocation (selectedLocation on marker placement)
12+
- Option to add used coordinate to resultlist
1213

1314
<!--
1415
"### Added" for new features.

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -331,6 +331,8 @@ class ExampleComponent {
331331
@Input() cascadingCoordinateLimit = 10;
332332
/* Cascading configuration for doing reverse lookups by coordinates */
333333
@Input() cascadingCoordinateRules: Array<CascadingCoordinateRulesModel> = this.locationPickerHelper.getDefaultCascadingConfig();
334+
/* If provided, adds coordinate to resultList at index */
335+
@Input() addCoordinateToResultsAt?: number = null;
334336
/* AddPolygon event */
335337
@Output() addPolygon = new EventEmitter<any>();
336338
/* AddLine event */

projects/ngx-location-picker/src/lib/components/ngx-location-picker.component.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,8 @@ export class NgxLocationPickerComponent implements OnInit, OnDestroy, ControlVal
114114
@Input() cascadingCoordinateLimit = 10;
115115
/* Cascading configuration for doing reverse lookups by coordinates */
116116
@Input() cascadingCoordinateRules: CascadingCoordinateRulesModel[] = [];
117+
/* If provided, adds coordinate to resultList at index */
118+
@Input() addCoordinateToResultsAt?: number = null;
117119
/* AddPolygon event */
118120
@Output() addPolygon = new EventEmitter<any>();
119121
/* AddLine event */
@@ -461,6 +463,11 @@ export class NgxLocationPickerComponent implements OnInit, OnDestroy, ControlVal
461463
).subscribe((response: LocationModel[] | AddressModel[] | CoordinateModel[]) => {
462464
this.foundLocations = response;
463465

466+
//adds used coordinate to result list
467+
if (this.addCoordinateToResultsAt) {
468+
this.foundLocations.splice(this.addCoordinateToResultsAt, 0, this.previousLocation);
469+
}
470+
464471
if (this.foundLocations.length && this.pickedLocation) {
465472
this.onLocationSelect(this.foundLocations[0], true);
466473
}

0 commit comments

Comments
 (0)