Created
October 14, 2016 04:27
-
-
Save maxca/ff0e5cd6af15b46c2c3efd6f81f843d5 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** switch env detect */ | |
(function() { | |
var switchEnv = angular.module('switchEnv', ['useConfigApp']); | |
switchEnv.service('serviceEnv', ['config','$location', function(config,$location) { | |
this.env = function(host){ | |
var host = !angular.isUndefined(host) ? host : $location.host(); | |
switch(host) { | |
case 'local': | |
return config.local; | |
break; | |
case 'staging': | |
return config.staging; | |
break; | |
case 'production': | |
return config.production; | |
break; | |
default: | |
return config.production; | |
break; | |
} | |
} | |
}]); | |
}()); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment