This repository was archived by the owner on Jun 23, 2025. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 821
Integration of agm-direction package #2035
Open
Open
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
151 changes: 151 additions & 0 deletions
packages/direction/README.md
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,151 @@ | ||
# Agm-Direction | ||
|
||
[](https://badge.fury.io/js/agm-direction) | ||
[](https://github.com/explooosion/Agm-Direction) | ||
[](https://travis-ci.org/explooosion/Agm-Direction) | ||
[](http://makeapullrequest.com) | ||
|
||
|
||
[Agm-Direction](https://github.com/explooosion/Agm-Direction) is the directive for [@agm/core](https://github.com/SebastianM/angular-google-maps) (not official) | ||
|
||
- Angular | ||
- Google Map API | ||
|
||
How to use? | ||
👉 [Start Reading](https://robby570.tw/Agm-Direction-Docs/) | ||
👉 [Build With Ionic](https://github.com/explooosion/ionic-agm-direction-example) | ||
|
||
|
||
 | ||
|
||
## Credit | ||
|
||
#### [SebastianM/angular-google-maps](https://github.com/SebastianM/angular-google-maps) - [Directions service #495](https://github.com/SebastianM/angular-google-maps/issues/495) | ||
|
||
## Installation | ||
|
||
Installation is done using the | ||
[`npm install` command](https://docs.npmjs.com/getting-started/installing-npm-packages-locally): | ||
|
||
- Use npm | ||
```bash | ||
npm install --save @agm/core agm-direction | ||
``` | ||
|
||
- Use yarn | ||
```bash | ||
yarn add @agm/core agm-direction | ||
``` | ||
|
||
## Importing Modules | ||
|
||
```typescript | ||
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 | ||
|
||
```html | ||
<agm-map [latitude]="lat" [longitude]="lng"> | ||
<agm-direction | ||
[origin]="origin" | ||
[destination]="destination" | ||
> | ||
</agm-direction> | ||
</agm-map> | ||
``` | ||
|
||
CSS | ||
|
||
```css | ||
agm-map { | ||
height: 400px; | ||
} | ||
``` | ||
|
||
TS | ||
|
||
```typescript | ||
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](https://robby570.tw/Agm-Direction-Docs/) | ||
- Less useful [AgmDirectionModule](https://robby570.tw/Agm-Direction/) | ||
|
||
## Development | ||
|
||
👉 [Playground Project](https://github.com/explooosion/Agm-Direction/tree/master/playground) | ||
|
||
```bash | ||
git clone https://github.com/explooosion/Agm-Direction.git | ||
``` | ||
|
||
## Generator | ||
This library was generated with [Angular CLI](https://github.com/angular/angular-cli) version 15.0.0. | ||
|
||
## Code scaffolding | ||
|
||
Run `ng generate component component-name --project agm-direction` to generate a new component. You can also use `ng generate directive|pipe|service|class|guard|interface|enum|module --project agm-direction`. | ||
> Note: Don't forget to add `--project agm-direction` or else it will be added to the default project in your `angular.json` file. | ||
|
||
## Build | ||
|
||
Run `ng build agm-direction` to build the project. The build artifacts will be stored in the `dist/` directory. | ||
|
||
## Publishing | ||
|
||
After building your library with `ng build agm-direction`, go to the dist folder `cd dist/agm-direction` and run `npm publish`. | ||
|
||
## Running unit tests | ||
|
||
Run `ng test agm-direction` to execute the unit tests via [Karma](https://karma-runner.github.io). | ||
|
||
## Further help | ||
|
||
To get more help on the Angular CLI use `ng help` or go check out the [Angular CLI Overview and Command Reference](https://angular.io/cli) page. | ||
|
||
|
||
## License | ||
|
||
[MIT](http://opensource.org/licenses/MIT) |
7 changes: 7 additions & 0 deletions
packages/direction/ng-package.json
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
{ | ||
"$schema": "../../node_modules/ng-packagr/ng-package.schema.json", | ||
"dest": "../../dist/agm-direction", | ||
"lib": { | ||
"entryFile": "src/public-api.ts" | ||
} | ||
} |
104 changes: 104 additions & 0 deletions
packages/direction/package-lock.json
Oops, something went wrong.
36 changes: 36 additions & 0 deletions
packages/direction/package.json
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
{ | ||
"name": "@agm/direction", | ||
"version": "0.8.11", | ||
"description": "Angular Google Maps direction", | ||
"license": "MIT", | ||
"author": { | ||
"name": "Robby", | ||
"email": "ta7382@gmail.com" | ||
}, | ||
"repository": { | ||
"type": "git", | ||
"url": "https://github.com/explooosion/agm-direction.git" | ||
}, | ||
"bugs": { | ||
"url": "https://github.com/explooosion/agm-direction/issues" | ||
}, | ||
"homepage": "https://github.com/explooosion/agm-direction", | ||
"keywords": [ | ||
"angular-google-maps", | ||
"angular", | ||
"google-maps-direction", | ||
"agm-direction", | ||
"direction", | ||
"angular-14.2" | ||
], | ||
"peerDependencies": { | ||
"@angular/common": "^15.0.0", | ||
"@angular/core": "^15.0.0" | ||
}, | ||
"dependencies": { | ||
|
||
}, | ||
"devDependencies": { | ||
"@types/googlemaps": "^3.39.8" | ||
} | ||
} |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.