0.1.9 • Published 7 years ago
ng-location-picker v0.1.9
ng-location-picker
This library for angular 4 allows the user to select a geographical location in a map. You just have to use the directive on any HTML element that can trigger a click event.
Installation
To install this library, run:
$ npm install ng-location-picker --save
First of all you have to include the google maps libraries in your application
<script src="https://maps.googleapis.com/maps/api/js?libraries=places"></script>
import {BrowserModule} from '@angular/platform-browser';
import {NgModule} from '@angular/core';
import {Component} from '@angular/core';
import {platformBrowserDynamic} from '@angular/platform-browser-dynamic';
import LatLng = google.maps.LatLng;
import {LocationPickerModule} from "ng-location-picker";
@Component({
selector: 'app',
template: `
<input ng-location-picker (onPickedLocation)="logPickedLocation($event)">`
})
class AppComponent {
static logPickedLocation(location: LatLngLiteral) {
console.log(location);
}
}
@NgModule({
bootstrap: [AppComponent],
declarations: [AppComponent],
imports: [BrowserModule, LocationPickerModule]
})
class AppModule {
}
Development
To generate all *.js
, *.d.ts
and *.metadata.json
files:
$ npm run build
To lint all *.ts
files:
$ npm run lint
License
MIT © Víctor Rodriguez