1.0.0 • Published 3 years ago

ang-google-map v1.0.0

Weekly downloads
3
License
ISC
Repository
github
Last release
3 years ago

Angular 2/4/6/8 Google Map

npm version

Angular 2+ Google Map Component.

Getting Started

Installation

  • Google map package is published on the npm Registry.
  • Install the package : npm install ang-google-map --save

-Generate google map api key from google developer site Link

-Once installed Add

  <script src="http://maps.googleapis.com/maps/api/js?key=<API_KEY>"> </script> 

to your index.html file head tag

  • import AngularGoogleMapModule from the installed package into your module as follows:

Usage

Import AngularGoogleMapModule into NgModule in app.module.ts. CommonModule is also required.

import { AngularGoogleMapModule } from 'ang-google-map';
import { CommonModule } from '@angular/common';

@NgModule({
  // ...
  imports: [
    AngularGoogleMapModule,
    CommonModule
  ]
  // ...
})

Add the following component tag in you template (no properties)

<ang-google-map [mapSettings]='settings' [width]="'100%'" [height]="'400px'" [padding]="'0'" [margin] ="'0'"></ang-google-map>

Full properties

  settings = {
    zoomValue: 15,
    isGeolocation: false,
    customStyles: [],
    latitude: 40.7128,
    longitude: 74.0060,
    enableGestureHandling: 'none',
    disableDefaultUI: true,
    isSatelliteView: false,
    isZoomControl: true,
    isStreetViewControl: false,
    showPixelAndCoordinates: true,
    address : {
      filed1: 'Bruce wayne',
      filed2: 'Wayne manor',
      filed3: '1007 Mountain Drive',
      filed4: 'Gotham',
      filed5: 'United States',
    },
    isDarkTheme: true,
    enableMarker: [{
      isEnable: true,
      isDragable: true,
      animation: true,
      clickToggle: true,
      lat: 0,
      lng: 0
    },{
      isEnable: true,
      isDragable: true,
      animation: true,
      clickToggle: true,
      lat: 0,
      lng: 0
    }]
  }

Properties

The following list of properties are supported by the component.

PropertyTypeDescriptionDefault Valueoptions
widthStringWidth of the map'100%'none
heightStringHeight of the map'400pxnone
paddingStringPadding of the to map'0'none
marginStringmargin of the to map'0'none
zoomValueNumberMap's initial zoom value15none
isGeolocationBooleanTake user's locationfalsenone
customStylesArrayAdd custom styles to map[]style options
latitudeNumberLatitude of the location40.7128none
longitudeNumberLongitude of the location74.0060none
enableGestureHandlingStringcontrol zoom, page scrollingnonecooperative, greedy, details
disableDefaultUIBooleanEnables/disables all default UI. May be overridden individuallytruenone
isSatelliteViewBooleanEnable Satellite View of the mapfalsenone
isZoomControlBooleanEnable UI for map zooming option (+ & -)truenone
isStreetViewControlBooleanThe initial enabled/disabled state of the Street View Pegman controlfalsenone
showPixelAndCoordinatesBooleanWorld coordinates, which reference a point on the map uniquely.truenone
addressObjectShow informations{ filed1: 'Bruce wayne', filed2: 'Wayne manor', filed3: '1007 Mountain Drive', filed4: 'Gotham',filed5: 'United States'}none
isDarkThemeBooleanEnable dark themetruenone
enableMarkerArrayMark places to map{ isEnable: true, isDragable: true, animation: true, clickToggle: true, lat: 0, lng: 0 }none

Run locally

  • Clone the repository or downlod the .zip,.tar files.
  • Run npm install
  • Run ng serve for a dev server
  • Navigate to http://localhost:4200/

License

MIT License.