angular.module('item',['ngRoute']); angular.module('item').factory('SubdomainService', [ '$location', function($location) { var service = {}; service.subdomain = window.location.host.split('.')[0]; if (window.location.host.split('.').length != 3) { service.subdomain = 'eus'; } return service; } ]);