Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // Google Map
- .controller('MapCtrl', function($scope, $ionicLoading, $compile) {
- function initialise() {
- var myLatlng = new google.maps.LatLng(53.068165,-4.076803);
- var mapOptions = {
- zoom: 15,
- center: myLatlng,
- mapTypeId: google.maps.MapTypeId.ROADMAP,
- }
- var map = new google.maps.Map(document.getElementById('map'), mapOptions);
- var marker = new google.maps.Marker({
- position: myLatlng,
- map: map,
- title: 'Hello World!'
- });
- $scope.map = map;
- }
- google.maps.event.addDomListener(window, 'load', initialise);
- $scope.centerOnMe = function() {
- if(!$scope.map) {
- return;
- }
- $scope.loading = $ionicLoading.show({
- showBackdrop: true
- });
- navigator.geolocation.getCurrentPosition(function(pos) {
- $scope.map.setCenter(new google.maps.LatLng(pos.coords.latitude, pos.coords.longitude));
- $scope.loading.hide();
- }, function(error) {
- alert('Unable to get location: ' + error.message);
- });
- };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement