Agm-Direction

npm version npm Dependency Status Build Status GitHub license PRs Welcome

Agm-Direction is the directive for @agm/core (not official)

How to use?
👉 Start Reading

Agm-Direction

Installation

Installation is done using the npm install command:

  • Use npm

    npm install --save @agm/core
    npm install --save agm-direction
    
  • Use yarn

    yarn add @agm/core
    yarn add agm-direction
    

Importing Modules

import { BrowserModule } from '@angular/platform-browser'
import { NgModule } from '@angular/core'
import { AppComponent } from './app.component'

import { AgmCoreModule } from '@agm/core'            // @agm/core
import { AgmDirectionModule } from 'agm-direction'   // agm-direction

@NgModule({
  declarations: [
    AppComponent
  ],
  imports: [
    BrowserModule,
    AgmCoreModule.forRoot({ // @agm/core
      apiKey: 'your key',
    }),
    AgmDirectionModule,     // agm-direction
  ],
  providers: [],
  bootstrap: [AppComponent]
})
export class AppModule { }

Usage

HTML

<agm-map [latitude]="lat" [longitude]="lng">
  <agm-direction [origin]="origin" [destination]="destination">
  </agm-direction>
</agm-map>

CSS

agm-map {
    height: 400px;
}

TS

public lat: Number = 24.799448
public lng: Number = 120.979021

public origin: any
public destination: any

ngOnInit() {
  this.getDirection()
}

getDirection() {
  this.origin = { lat: 24.799448, lng: 120.979021 }
  this.destination = { lat: 24.799524, lng: 120.975017 }

  // this.origin = 'Taipei Main Station'
  // this.destination = 'Taiwan Presidential Office'
}

Document

Development

👉 Playground

git clone https://github.com/explooosion/Agm-Direction.git
cd playground
yarn start

Development Doc

This library generated by angular-library-starter.

Document

git clone https://github.com/explooosion/Agm-Direction-Docs.git
npm install -g gitbook-cli
gitbook update
gitbook install
yarn dev

License

MIT