In my HomeCtrl.js I am calling function currentLocation() from another function initialize() , I defined this fuction but it gives me an error of function is not defined :\
Code Updated But still same error occurred
Can anybody tell me what is the problem in my code?
HomeCtrl.js
'use strict';
angular.module('Home').controller('HomeCtrl',['$scope','$state','MessageService', function($scope, $state, $ionicModal, MessageService) {
(function initialize(){
var location = $scope.currentLocation();
$scope.mapOptions = {
mapTypeControl: true,
zoom: 15,
mapTypeId: google.maps.MapTypeId.ROADMAP,
center: location
};
})();
$scope.currentLocation = function(){
navigator.geolocation.getCurrentPosition(function(pos) {
$scope.position = new google.maps.LatLng(pos.coords.latitude, pos.coords.longitude);
return $scope.position;
});
};
}]);