Skip to content

Commit 15cd7ab

Browse files
committed
Fix domain comprobation in check() method
1 parent b2f51ff commit 15cd7ab

File tree

2 files changed

+20
-6
lines changed

2 files changed

+20
-6
lines changed

dist/angular-environment.js

Lines changed: 18 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -97,18 +97,31 @@ angular.module('environment', []).
9797
* @return {Void}
9898
*/
9999
this.check = function() {
100-
var location = window.location.host,
101-
self = this;
100+
var self = this,
101+
location = window.location.host,
102+
matches = [],
103+
keepGoing = true;
102104

103105
angular.forEach(this.data.domains, function(v, k) {
104106
angular.forEach(v, function(v) {
105107
if (location.match(local.stringToRegex(v))) {
106-
self.environment = k;
107-
108-
return false;
108+
matches.push({
109+
environment: k,
110+
domain: v
111+
});
109112
}
110113
});
111114
});
115+
116+
angular.forEach(matches, function(v, k) {
117+
if (keepGoing) {
118+
if (location === v.domain) {
119+
keepGoing = false;
120+
}
121+
console.log(v.domain);
122+
self.environment = v.environment;
123+
}
124+
});
112125
};
113126

114127
this.$get = function() {

dist/angular-environment.min.js

Lines changed: 2 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)