@ajqua/marker-with-label

Angular Google Maps (AGM) extension for markerwithlabel support

Usage no npm install needed!

<script type="module">
  import ajquaMarkerWithLabel from 'https://cdn.skypack.dev/@ajqua/marker-with-label';
</script>

README

Marker with label for AGM


this package levereges the markerwithlabel to add possibility to change marker's label style with css class in AGM.

Installation

@ajqua/marker-with-label has a peer depedency on markerwithlabel npm package

npm install markerwithlabel @ajqua/marker-with-label --save
# or
yarn add markerwithlabel @ajqua/marker-with-label

Usage

  1. Import the module

    import { BrowserModule } from '@angular/platform-browser';
    import { NgModule } from '@angular/core';
    import { AppComponent } from './app.component';
    
    // add these imports
    import { AgmCoreModule } from '@ajqua/core';
    import { AgmMarkerWithLabelModule } from '@ajqua/marker-with-label';
    
    @NgModule({
      declarations: [
        AppComponent
      ],
      imports: [
        BrowserModule,
        AgmCoreModule.forRoot({
          apiKey: ['YOUR_API_KEY_HERE']
        }),
        AgmMarkerWithLabelModule
      ],
      providers: [],
      bootstrap: [AppComponent]
    })
    export class AppModule { }
    
  2. use it in your template

    <agm-map style="height: 300px" [latitude]="51.673858" [longitude]="7.815982">
      <agm-marker-with-label [latitude]="32.085299899999995" [longitude]="34.781767599999995"
        labelContent="Label marker" labelClass="marker-label-class"
        [labelInBackground]="true" [labelAnchor]="{x: 30, y: -9}"></agm-marker-with-label>
    </agm-map>