Source: services/LocationService.js

    /**
     * @ngdoc service
     * @name LocationService
     * @module s4c.services.LocationService
     * 
     * @description  Componente para acesso a api do backend e/ou comunicação entre controllers
     * 
     *
     */
     
(function () {

    angular.module('s4c.services')
        .factory('LocationService', LocationService);

    LocationService.$inject = ['$rootScope', 'MapaService'];

   /**	
	* @method LocationService
	* @param {*} $rootScope
	* @param {*} MapaService
	*/
    function LocationService($rootScope, MapaService) {

        var service = {
            getLocation: getLocation,
            getLat: getLat,
            getLon: getLon
        };

        var lat = undefined;
        var lon = undefined;

  		/**	
		* @method getLocation
=		*/
        function getLocation() {

            if (navigator.geolocation) {
                navigator.geolocation.getCurrentPosition(showPosition);
            }
        }

  		/**	
		* @method showPosition
		* @param {*} position
		*/
        function showPosition(position) {
            lat = position.coords.latitude;
            lon = position.coords.longitude;
        }

  		/**	
		* @method getLat
		*/
        function getLat() {
            if (!lat) {
                return -22.94249;
            }
            return lat;
        }

  		/**	
		* @method getLon
		*/
        function getLon() {
            if (!lon) {
                return -43.48789;
            }
            return lon;
        }

        return service;
    }
}());