Currently, I am encapsulating a global variable within a factory in order to make it injectable. Here is an example of how it's done:
angular.module('Analytics').factory('woopra', [
'$window',
function ($window) {
return $window.woopra;
}
]);
Due to the functionality of this tool, at some point in the future, after initialization, the variable woopra
on the window will be replaced with a new value.
I require the injectable factory woopra to refer to this new woopra variable that is now on the window. Is there a more elegant way to achieve this? Currently, I am simply referencing it as $window.woopra
so that I can mock $window
.