Last active
July 11, 2017 17:44
-
-
Save iparrabb/7560237243d2716a84a93dca4db8439f to your computer and use it in GitHub Desktop.
This file contains 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
<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> |
This file contains 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
@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