Having some difficulty displaying my geolocation on Google Maps API using a marker.
I am utilizing the ng controller ngGeolocation and the http://angular-ui.github.io/angular-google-maps/
Previously, I hardcoded the marker and map location without any issues. However, upon changing the controller, the map disappeared.
Any assistance would be greatly appreciated.
My controller:
'use strict';
angular.module('fiveMinCatchupApp')
.controller('MainCtrl', function ($scope, uiGmapGoogleMapApi) {
var scope = $scope;
var lat;
var lng;
function getLocation() {
navigator.geolocation.getCurrentPosition($scope.showLocation);
};
$scope.showLocation = function(position){
lat = position.coords.latitude;
lng = position.coords.longitude;
$scope.map = {
center: {
latitude: position.coords.latitude,
longitude: position.coords.longitude,
},
zoom: 8
}
};
getLocation();
Main html
<ui-gmap-google-map center="map.center" zoom="map.zoom">
<ui-gmap-markers
models='markers'
coords="'coords'">
</ui-gmap-markers>
</ui-gmap-google-map>
HTML
<body ng-app="fiveMinCatchupApp">
<div class="container">
<div ng-view=""></div>
</div>
<div class="footer">
<div class="container">
<p><span class="glyphicon glyphicon-heart"></span> from the Yeoman team</p>
</div>
</div>
<!-- Google Analytics: change UA-XXXXX-X to be your site's ID -->
<script>
!function(A,n,g,u,l,a,r){A.GoogleAnalyticsObject=l,A[l]=A[l]||function(){
(A[l].q=A[l].q||[]).push(arguments)},A[l].l=+new Date,a=n.createElement(g),
r=n.getElementsByTagName(g)[0],a.src=u,r.parentNode.insertBefore(a,r)
}(window,document,'script','//www.google-analytics.com/analytics.js','ga');
ga('create', 'UA-XXXXX-X');
ga('send', 'pageview');
</script>
<script src='//maps.googleapis.com/maps/api/js?sensor=false'></script>
<!-- build:js(.) scripts/vendor.js -->
<!-- bower:js -->
<script src="bower_components/jquery/dist/jquery.js"></script>
<script src="bower_components/angular/angular.js"></script>
<script src="bower_components/bootstrap/dist/js/bootstrap.js"></script>
<script src="bower_components/angular-animate/angular-animate.js"></script>
<script src="bower_components/angular-cookies/angular-cookies.js"></script>
<script src="bower_components/angular-resource/angular-resource.js"></script>
<script src="bower_components/angular-route/angular-route.js"></script>
<script src="bower_components/angular-sanitize/angular-sanitize.js"></script>
<script src="bower_components/angular-touch/angular-touch.js"></script>
<script src="bower_components/lodash/dist/lodash.compat.js"></script>
<script src="bower_components/angular-google-maps/dist/angular-google-maps.js"></script>
<script src="bower_components/ngGeolocation/ngGeolocation.js"></script>
<!-- endbower -->
<!-- endbuild -->
<!-- build:js({.tmp,app}) scripts/scripts.js -->
<script src="scripts/app.js"></script>
<script src="scripts/controllers/main.js"></script>
<script src="scripts/controllers/about.js"></script>
<!-- endbuild -->
Thank you!
Previous version hardcoded on github at https://github.com/5-minute-catchup/5-min-catchup/commit/2899e013a78e93016154f1bd7d462b83f414db7e