ngx-mat-geocoding

Component to get a list of place with a geocoding service

Usage no npm install needed!

<script type="module">
  import ngxMatGeocoding from 'https://cdn.skypack.dev/ngx-mat-geocoding';
</script>

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

  1. 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 {
}
  1. 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(() => {
            
        });