Skip to content

Commit e227242

Browse files
committed
Fixed domain comprobation during check() method, causing a fail comprobation when having a TLD and subdomains from the same TLD
1 parent 06a58ec commit e227242

File tree

3 files changed

+7
-7
lines changed

3 files changed

+7
-7
lines changed

dist/angular-environment.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/**
22
* angular-environment Plugin
33
*
4-
* An useful plugin that gives you an opportunity to set up different information
4+
* An useful plugin that allows you to set up different information
55
* such as api endpoints, urls, variables, etc, based on the context of scripts execution:
66
* development, stage, production or any other custom environment you want to create.
77
*
@@ -82,12 +82,12 @@ angular.module('environment', []).
8282
* @return {Void}
8383
*/
8484
this.check = function() {
85-
var hostname = window.location.hostname,
85+
var location = window.location.href,
8686
self = this;
8787

8888
angular.forEach(this.data.domains, function(v, k) {
8989
angular.forEach(v, function(v) {
90-
if (hostname.search(v) !== -1) {
90+
if (location.match('//' + v)) {
9191
self.environment = k;
9292
}
9393
});

dist/angular-environment.min.js

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

src/angular-environment.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/**
22
* angular-environment Plugin
33
*
4-
* An useful plugin that gives you an opportunity to set up different information
4+
* An useful plugin that allows you to set up different information
55
* such as api endpoints, urls, variables, etc, based on the context of scripts execution:
66
* development, stage, production or any other custom environment you want to create.
77
*
@@ -82,12 +82,12 @@ angular.module('environment', []).
8282
* @return {Void}
8383
*/
8484
this.check = function() {
85-
var hostname = window.location.hostname,
85+
var location = window.location.href,
8686
self = this;
8787

8888
angular.forEach(this.data.domains, function(v, k) {
8989
angular.forEach(v, function(v) {
90-
if (hostname.search(v) !== -1) {
90+
if (location.match('//' + v)) {
9191
self.environment = k;
9292
}
9393
});

0 commit comments

Comments
 (0)