@amin-karimi/agm-direction
v1.0.2
Published
Angular Google Maps direction
Downloads
29
Maintainers
Readme
Agm-Direction
This library was generated with Angular CLI version 14.2.0.
Agm-Direction is the directive for @amin-karimi/agm-core
- Angular
- Google Map API
How to use?
👉 Start Reading
Credit
SebastianM/angular-google-maps - Directions service #495
Installation
Installation is done using the
npm install
command:
- Use npm
npm install --save @amin-karimi/agm-core agm-direction
Importing Modules
import { BrowserModule } from '@angular/platform-browser';
import { NgModule } from '@angular/core';
import { AppComponent } from './app.component';
import { AgmCoreModule } from '@amin-karimi/agm-core'; // @agm/core
import { AgmDirectionModule } from '@amin-karimi/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 = 24.799448;
public lng = 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 };
// Location within a string
// this.origin = 'Taipei Main Station';
// this.destination = 'Taiwan Presidential Office';
}
Document
- Document Agm-Direction-Docs
- Less useful AgmDirectionModule
Generator
This library generated by angular-library-starter.