Created
November 20, 2015 20:18
-
-
Save sonicparke/eab12313e6e7a14dbe87 to your computer and use it in GitHub Desktop.
namespaces
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
(function() { | |
angular.module('vcModules') | |
.factory('QualityService', QualityService); | |
QualityService.$inject = ['$rootScope','AppLocalStorage']; | |
function QualityService($rootScope, AppLocalStorage) { | |
var vm = this; | |
var foo, bar; | |
// Things we need to expose to other things :-) | |
return { | |
professional: professional, | |
facility: facility | |
}; | |
// professional namespace | |
function professional() { | |
return { | |
assignConfig: function() { | |
foo = 'professional foo'; | |
console.log(foo); | |
}, | |
assignQuality: function() { | |
bar = 'professional bar'; | |
console.log(bar); | |
} | |
}; | |
} | |
// facility namespace | |
function facility() { | |
return { | |
assignConfig: function() { | |
foo = 'facility foo'; | |
console.log(foo); | |
}, | |
assignQuality: function() { | |
bar = 'facility bar'; | |
console.log(bar); | |
} | |
}; | |
} | |
} | |
})(); |
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
(function() { | |
angular.module('vcModules') | |
.factory('QualityService', QualityService); | |
QualityService.$inject = ['$rootScope','AppLocalStorage']; | |
function QualityService($rootScope, AppLocalStorage) { | |
var vm = this; | |
var foo, bar; | |
// Things we need to expose to other things :-) | |
return { | |
professionalAssignConfig: professionalAssignConfig, | |
professionalAssignQuality: professionalAssignQuality, | |
facilityAssignConfig: facilityAssignConfig, | |
facilityAssignQuality: facilityAssignQuality | |
}; | |
function professionalAssignConfig() { | |
foo = 'professional foo'; | |
console.log(foo); | |
} | |
function professionalAssignQuality() { | |
bar = 'professional bar'; | |
console.log(bar); | |
} | |
function facilityAssignConfig() { | |
foo = 'facility foo'; | |
console.log(foo); | |
} | |
function facilityAssignQuality() { | |
bar = 'facility bar'; | |
console.log(bar); | |
} | |
} | |
})(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I like option2.js better. You can quickly at a glance see what methods are available in the service. Option1.js requires the developer to scroll down to the method to see what's available.