mirror of
https://github.com/danielsogl/awesome-cordova-plugins.git
synced 2025-01-19 16:52:53 +08:00
Update Example for Google Map
This commit is contained in:
parent
fa03fa544f
commit
e6beaa49a4
@ -41,46 +41,63 @@ export const GoogleMapsAnimation = {
|
|||||||
* @description This plugin uses the native Google Maps SDK
|
* @description This plugin uses the native Google Maps SDK
|
||||||
* @usage
|
* @usage
|
||||||
* ```
|
* ```
|
||||||
* import { GoogleMap, GoogleMapsEvent } from 'ionic-native';
|
* import {
|
||||||
|
* GoogleMap,
|
||||||
|
* GoogleMapsEvent,
|
||||||
|
* GoogleMapsLatLng,
|
||||||
|
* CameraPosition,
|
||||||
|
* GoogleMapsMarkerOptions,
|
||||||
|
* GoogleMapsMarker
|
||||||
|
* } from 'ionic-native';
|
||||||
*
|
*
|
||||||
* // create a new map using element ID
|
* export class MapPage {
|
||||||
* let map = new GoogleMap('elementID');
|
* constructor() {}
|
||||||
*
|
*
|
||||||
* // or create a new map by passing HTMLElement
|
* // Load map only after view is initialize
|
||||||
* let element: HTMLElement = document.getElementById('elementID');
|
* ngAfterViewInit() {
|
||||||
|
* this.loadMap();
|
||||||
|
* }
|
||||||
|
*
|
||||||
|
* loadMap() {
|
||||||
|
* // make sure to create following structure in your view.html file
|
||||||
|
* // <ion-content>
|
||||||
|
* // <div #map id="map"></div>
|
||||||
|
* // </ion-content>
|
||||||
*
|
*
|
||||||
* // In Angular 2 or Ionic 2, if we have this element in html: <div #map></div>
|
* // create a new map by passing HTMLElement
|
||||||
* // then we can use @ViewChild to find the element and pass it to GoogleMaps
|
* let element: HTMLElement = document.getElementById('map');
|
||||||
* @ViewChild('map') mapElement;
|
*
|
||||||
* let map = new GoogleMap(mapElement);
|
* let map = new GoogleMap(element);
|
||||||
*
|
*
|
||||||
* // listen to MAP_READY event
|
* // listen to MAP_READY event
|
||||||
* map.one(GoogleMapsEvent.MAP_READY).then(() => console.log('Map is ready!'));
|
* map.one(GoogleMapsEvent.MAP_READY).then(() => console.log('Map is ready!'));
|
||||||
*
|
*
|
||||||
|
* // create LatLng object
|
||||||
|
* let ionic: GoogleMapsLatLng = new GoogleMapsLatLng(43.0741904,-89.3809802);
|
||||||
*
|
*
|
||||||
* // create LatLng object
|
* // create CameraPosition
|
||||||
* let ionic: GoogleMapsLatLng = new GoogleMapsLatLng(43.0741904,-89.3809802);
|
* let position: CameraPosition = {
|
||||||
|
* target: ionic,
|
||||||
|
* zoom: 18,
|
||||||
|
* tilt: 30
|
||||||
|
* };
|
||||||
*
|
*
|
||||||
* // create CameraPosition
|
* // move the map's camera to position
|
||||||
* let position: CameraPosition = {
|
* map.moveCamera(position);
|
||||||
* target: ionic,
|
|
||||||
* zoom: 18,
|
|
||||||
* tilt: 30
|
|
||||||
* };
|
|
||||||
*
|
*
|
||||||
* // move the map's camera to position
|
* // create new marker
|
||||||
* map.moveCamera(position);
|
* let markerOptions: GoogleMapsMarkerOptions = {
|
||||||
|
* position: ionic,
|
||||||
|
* title: 'Ionic'
|
||||||
|
* };
|
||||||
*
|
*
|
||||||
* // create new marker
|
* map.addMarker(markerOptions)
|
||||||
* let markerOptions: GoogleMapsMarkerOptions = {
|
* .then((marker: GoogleMapsMarker) => {
|
||||||
* position: ionic,
|
* marker.showInfoWindow();
|
||||||
* title: 'Ionic'
|
* });
|
||||||
* };
|
* }
|
||||||
*
|
*
|
||||||
* map.addMarker(markerOptions)
|
* }
|
||||||
* .then((marker: GoogleMapsMarker) => {
|
|
||||||
* marker.showInfoWindow();
|
|
||||||
* });
|
|
||||||
* ```
|
* ```
|
||||||
*/
|
*/
|
||||||
@Plugin({
|
@Plugin({
|
||||||
|
Loading…
Reference in New Issue
Block a user