Permalink
Browse files

Update indents

  • Loading branch information...
1 parent ec1c299 commit 9a2adccf49496cd89d366d6c1615a30ab3578c6d @mikepugh committed Feb 2, 2014
Showing with 99 additions and 99 deletions.
  1. +96 −96 scripts/angulargeo.js
  2. +3 −3 scripts/providers/angulargeo-bing.js
View
@@ -3,107 +3,107 @@
*/
(function() {
- "use strict";
+ "use strict";
- var angularGeo = angular.module('angular-geo', []);
- angularGeo.provider('angularGeo', function() {
- var $$geoConfig = {
- providerSvcNames: [],
- providers: []
- };
- var $$supportsGeolocation = 'geolocation' in navigator;
- var $$watchId;
- var $$currentProvider = 0;
+ var angularGeo = angular.module('angular-geo', []);
+ angularGeo.provider('angularGeo', function() {
+ var $$geoConfig = {
+ providerSvcNames: [],
+ providers: []
+ };
+ var $$supportsGeolocation = 'geolocation' in navigator;
+ var $$watchId;
+ var $$currentProvider = 0;
- return {
- addProvider: function (providerSvcName) {
- $$geoConfig.providerSvcNames.push(providerSvcName);
- return this;
- },
- $get: function ($log, $q, $timeout, $rootScope, $injector) {
- if($$geoConfig.providerSvcNames.length === 0) {
- throw new Error("AngularGeo requires at least 1 geo provider");
- }
- // Instantiate the geo providers and store them within the $$geoConfig object
- for(var i = 0; i < $$geoConfig.providerSvcNames.length; i++) {
- if(!$injector.has($$geoConfig.providerSvcNames[i])) {
- $log.error('angularGeo could not locate service ' + $$geoConfig.providerSvcNames[i]);
- } else {
- $$geoConfig.providers.push($injector.get($$geoConfig.providerSvcNames[i]));
- }
- }
- var $$providers = $$geoConfig.providers;
- if($$providers.length === 0) {
- throw new Error('angularGeo could not locate any of the geo providers specified, verify that you have them properly linked');
- }
+ return {
+ addProvider: function (providerSvcName) {
+ $$geoConfig.providerSvcNames.push(providerSvcName);
+ return this;
+ },
+ $get: function ($log, $q, $timeout, $rootScope, $injector) {
+ if($$geoConfig.providerSvcNames.length === 0) {
+ throw new Error("AngularGeo requires at least 1 geo provider");
+ }
+ // Instantiate the geo providers and store them within the $$geoConfig object
+ for(var i = 0; i < $$geoConfig.providerSvcNames.length; i++) {
+ if(!$injector.has($$geoConfig.providerSvcNames[i])) {
+ $log.error('angularGeo could not locate service ' + $$geoConfig.providerSvcNames[i]);
+ } else {
+ $$geoConfig.providers.push($injector.get($$geoConfig.providerSvcNames[i]));
+ }
+ }
+ var $$providers = $$geoConfig.providers;
+ if($$providers.length === 0) {
+ throw new Error('angularGeo could not locate any of the geo providers specified, verify that you have them properly linked');
+ }
- var $$geocode = function(address, bounds, region, restrictions, filters, promise) {
- var deferred = promise || $q.defer();
- var p = $$providers[$$currentProvider].geocode(address, bounds, region, restrictions, filters);
- p.then(function(results) {
- deferred.resolve(results);
- }, function(err) {
- if($$providers.length === 1) {
- deferred.reject(err);
- }
- if($$currentProvider < $$providers.length - 1) {
- $$currentProvider++;
- } else {
- $$currentProvider = 0;
- }
- return $$geocode(address, bounds, region, restrictions, filters, deferred);
- });
- return deferred.promise;
- };
+ var $$geocode = function(address, bounds, region, restrictions, filters, promise) {
+ var deferred = promise || $q.defer();
+ var p = $$providers[$$currentProvider].geocode(address, bounds, region, restrictions, filters);
+ p.then(function(results) {
+ deferred.resolve(results);
+ }, function(err) {
+ if($$providers.length === 1) {
+ deferred.reject(err);
+ }
+ if($$currentProvider < $$providers.length - 1) {
+ $$currentProvider++;
+ } else {
+ $$currentProvider = 0;
+ }
+ return $$geocode(address, bounds, region, restrictions, filters, deferred);
+ });
+ return deferred.promise;
+ };
- return {
- geocode: function(address, bounds, region, restrictions, filters) {
- return $$geocode(address, bounds, region, restrictions, filters, null);
- },
- reverseGeocode: function(latLng, bounds, region, restrictions, filters) {},
- getCurrentPosition: function(options, autoReverseGeocode) {
- var self = this;
- if(!$$supportsGeolocation) {
- throw new Error("Browser geolocation not supported");
- }
- var deferred = $q.defer();
- navigator.geolocation.getCurrentPosition(function(pos) {
- if(autoReverseGeocode) {
- var p = self.reverseGeocode({latitude: pos.coords.latitude, longitude: pos.coords.longitude}, null, null, null, null);
- p.then(function(results) {
- deferred.resolve(results);
- }, function(err) {
- deferred.reject(err);
- });
- }
- deferred.resolve(pos);
- }, function(err) {
- deferred.reject(err);
- }, options);
- return deferred.promise;
- },
- watchPosition: function(options) {
- var self = this;
- if(!$$supportsGeolocation) {
- throw new Error("Browser geolocation not supported");
- }
- var deferred = $q.defer();
- $$watchId = navigator.geolocation.watchPosition(function(pos) {
- $rootScope.$broadcast("angulargeo:watchposition", pos);
- }, function(err) {
- deferred.reject(err);
- }, options);
- return deferred.promise;
+ return {
+ geocode: function(address, bounds, region, restrictions, filters) {
+ return $$geocode(address, bounds, region, restrictions, filters, null);
+ },
+ reverseGeocode: function(latLng, bounds, region, restrictions, filters) {},
+ getCurrentPosition: function(options, autoReverseGeocode) {
+ var self = this;
+ if(!$$supportsGeolocation) {
+ throw new Error("Browser geolocation not supported");
+ }
+ var deferred = $q.defer();
+ navigator.geolocation.getCurrentPosition(function(pos) {
+ if(autoReverseGeocode) {
+ var p = self.reverseGeocode({latitude: pos.coords.latitude, longitude: pos.coords.longitude}, null, null, null, null);
+ p.then(function(results) {
+ deferred.resolve(results);
+ }, function(err) {
+ deferred.reject(err);
+ });
+ }
+ deferred.resolve(pos);
+ }, function(err) {
+ deferred.reject(err);
+ }, options);
+ return deferred.promise;
+ },
+ watchPosition: function(options) {
+ var self = this;
+ if(!$$supportsGeolocation) {
+ throw new Error("Browser geolocation not supported");
+ }
+ var deferred = $q.defer();
+ $$watchId = navigator.geolocation.watchPosition(function(pos) {
+ $rootScope.$broadcast("angulargeo:watchposition", pos);
+ }, function(err) {
+ deferred.reject(err);
+ }, options);
+ return deferred.promise;
- },
- clearWatch: function() {
- if(!$$supportsGeolocation) {
- throw new Error("Browser geolocation not supported");
- }
- navigator.geolocation.clearWatch($$watchId);
- }
- }
+ },
+ clearWatch: function() {
+ if(!$$supportsGeolocation) {
+ throw new Error("Browser geolocation not supported");
}
+ navigator.geolocation.clearWatch($$watchId);
+ }
}
- });
+ }
+ }
+ });
}).call(this);
@@ -19,9 +19,9 @@
httpPromise.success(function(data, status, headers, config) {
deferred.resolve(data);
})
- .error(function(data, status, headers, config) {
- deferred.reject({data: data, status: status});
- });
+ .error(function(data, status, headers, config) {
+ deferred.reject({data: data, status: status});
+ });
return deferred.promise;
},

0 comments on commit 9a2adcc

Please sign in to comment.