README
Ngx-Mat-Geocoding
- A simple service that return a list of places after searching an address
Installation
npm i ngx-mat-geocoding
|
Usage
GeocodingLocation is the bean mapped by the service
- Register the
NgxMatGeocodingModule
in your app module.
import { NgxMatGeocodingModule } from 'ngx-mat-geocoding
import { NgModule } from '@angular/core';
import {NgxMatGeocodingModule} from 'ngx-mat-geocoding';
import {CommonModule} from '@angular/common';
const COMPONENTS = [
NgxMatGeocodingModule
];
@NgModule({
declarations: [],
imports: [
CommonModule,
...COMPONENTS
],
exports: [...COMPONENTS]
})
export class ComponentModule {
}
- Subscribe to subjects
//to get the results
this.geocodingService.geocode(this.address).subscribe((res: GeocodingLocation[]) => {
});
//When the result is empty
geocodingService.subjectNoResults.subscribe(() => {
});
//When selecting one from the list
geocodingService.subjectLocation.subscribe((res: GocodingLocation) => {
});
//On removing
geocodingService.subjectRemove.subscribe(() => {
});