Dark Mode

Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

BrunoAlencar/ionic3-google-maps-examples

Repository files navigation

Ionic 3 examples of using Google Maps API

Some examples of how to use google maps javascript API on a Ionic application and use HTML5 geolocation.

Starting

  1. First you need to visit the google maps javascript API (https://developers.google.com/maps/documentation/javascript/) then get your key.
  2. Second you need the api in your src/index.html, this https://maps.googleapis.com/maps/api/js?key=YOUR-KEY-HERE.

Using Google Maps Javascript API

  1. First example:
  • On the html page i just put this div:

  • Some css
#map {
height: 100%;
}
  • On typescript step, i have to do something first. Declare a google variable.
declare const google;
  • Then i can use it.
@ViewChild('map') mapElement: ElementRef;
map: any;

ionViewDidLoad() {
let posMaceio = { lat: -9.648139, lng: -35.717239 }
this.map = new google.maps.Map(this.mapElement.nativeElement, {
zoom: 8,
center: posMaceio,
mapTypeId: 'roadmap'
});
this.map.setCenter(posMaceio);
}
  • I hope you enjoyed the first example

License

The MIT License (MIT). Please see License File for more information.

About

Some examples of how to use google maps javascript API on a Ionic application and use HTML5 geolocation.

Topics

Resources

Readme

License

MIT license

Stars

Watchers

Forks

Releases

No releases published

Packages

Contributors