Skip to content

Instantly share code, notes, and snippets.

@iparrabb
Last active July 11, 2017 17:44
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save iparrabb/7560237243d2716a84a93dca4db8439f to your computer and use it in GitHub Desktop.
Save iparrabb/7560237243d2716a84a93dca4db8439f to your computer and use it in GitHub Desktop.
<ion-content no-padding>
<div #map id="map" style="height: 100%;">
<ion-header>
<ion-input type="text" placeholder="Type you address..."></ion-input>
</ion-header>
<ion-footer>
<ion-row>
<ion-col>
<button ion-button block (click)="callButton1()">Button 1</button>
</ion-col>
<ion-col>
<button ion-button block (click)="callButton2()">Button 2</button>
</ion-col>
</ion-row>
</ion-footer>
</div>
</ion-content>
@IonicPage({
name: 'map'
})
@Component({
selector: 'page-map',
templateUrl: 'map.html',
})
export class MapPage {
map: GoogleMap;
constructor(
private googleMaps: GoogleMaps
) {
}
ngAfterViewInit() {
this.loadMap();
}
loadMap() {
let element: HTMLElement = document.getElementById('map');
this.map = this.googleMaps.create(element);
this.map.one(GoogleMapsEvent.MAP_READY)
.then(() => {
console.log('map ready');
});
let cdw: LatLng = new LatLng(41.397766, 2.135378);
let position: CameraPosition = {
target: cdw,
zoom: 14,
tilt: 30,
};
this.map.moveCamera(position);
let markerOptions: MarkerOptions = {
position: cdw,
title: 'Cursosdesarrolloweb'
};
this.map.clear();
this.map.addMarker(markerOptions)
.then((marker: Marker) => {
marker.showInfoWindow();
});
}
public callButton1() {
alert('button 1');
}
public callButton2() {
alert('button 2');
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment