Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Nasty bug when trying to implement native GMap functionality #9803

Closed
elie-h opened this issue Dec 27, 2016 · 2 comments
Closed

Nasty bug when trying to implement native GMap functionality #9803

elie-h opened this issue Dec 27, 2016 · 2 comments

Comments

@elie-h
Copy link

elie-h commented Dec 27, 2016

Ionic version: (check one with "x")
[ ] 1.x
[x] **2.0.0-rc.4

I'm submitting a ... (check one with "x")
[x] bug report
[ ] feature request
[ ] support request => Please do not submit support requests here, use one of these channels: https://forum.ionicframework.com/ or http://ionicworldwide.herokuapp.com/

Current behavior:
I'm getting this unexpected bug when I implement a native google maps on a page:
http://imgur.com/a/tKOAX
Expected behavior:
I expected to see a map with a marker

Related code:
map.html:

<ion-header>
  <ion-navbar>
    <ion-title>
      Map
    </ion-title>
  </ion-navbar>
</ion-header>

<ion-content class="home">

  <h1>hi</h1>
  <div style="height: 300px; height: 100%; width: 100%; background-color: #999;" #map id="map"></div>

</ion-content>

map.ts:
import {Component} from "@angular/core";

import {
GoogleMap,
GoogleMapsEvent,
GoogleMapsLatLng,
CameraPosition,
GoogleMapsMarkerOptions,
GoogleMapsMarker
} from 'ionic-native';

@component({
templateUrl: 'map.html'
})
export class MapPage {
constructor() {}

// Load map only after view is initialize
ngAfterViewInit() {
this.loadMap();
}

loadMap() {
// create a new map by passing HTMLElement
let element: HTMLElement = document.getElementById('map');

let map = new GoogleMap(element);

// listen to MAP_READY event
map.one(GoogleMapsEvent.MAP_READY).then(() => console.log('Map is ready!'));

// create LatLng object
let ionic: GoogleMapsLatLng = new GoogleMapsLatLng(43.0741904,-89.3809802);

// create CameraPosition
let position: CameraPosition = {
  target: ionic,
  zoom: 18,
  tilt: 30
};

// move the map's camera to position
map.moveCamera(position);

// create new marker
let markerOptions: GoogleMapsMarkerOptions = {
  position: ionic,
  title: 'Ionic'
};

map.addMarker(markerOptions)
  .then((marker: GoogleMapsMarker) => {
    marker.showInfoWindow();
  });

}
}

Other information:
I'm running the application on an ios simulator

Ionic info: (run ionic info from a terminal/cmd prompt and paste output below):

Cordova CLI: 6.4.0 
Ionic Framework Version: 2.0.0-rc.4
Ionic CLI Version: 2.1.18
Ionic App Lib Version: 2.1.9
Ionic App Scripts Version: 0.0.47
ios-deploy version: Not installed
ios-sim version: 5.0.13 
OS: macOS Sierra
Node Version: v6.9.2
Xcode version: Xcode 8.2 Build version 8C38
@jgw96
Copy link
Contributor

jgw96 commented Dec 27, 2016

This issue was moved to danielsogl/awesome-cordova-plugins#917

@ionitron-bot
Copy link

ionitron-bot bot commented Sep 5, 2018

Thanks for the issue! This issue is being locked to prevent comments that are not relevant to the original issue. If this is still an issue with the latest version of Ionic, please create a new issue and ensure the template is fully filled out.

@ionitron-bot ionitron-bot bot locked and limited conversation to collaborators Sep 5, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants