title: Using shared module (between separate modules)
body: <p>So I have a module I have created that does a kind of "state" routing for me. I made my own little version to get my exact intended effect, and it seems to be working great until I plug it into separate modules to test.</p>
  
  <p>I inject it into the 2 separate modules, define the  information in the .config of each module I need to use it, then call it in a controller to use my change state kind of effect.</p>
  
  <p>It had been going pretty good until I plugged it into separate modules, and now what seems to be happening is the module I have created to handle all of this is creating separate instances for each module. Let me show you what I mean: </p>
  
  <p>Here is an example of one of the modules using it for testing -</p>
  
  <pre><code>  angular.
  module('urlTesting2', [ 'urlTesting'])
      .config(function($moduleObjectProvider) {
          var callback = function(name, obj) {
              console.log(name, obj);
          }
  
          $moduleObjectProvider.$get().set("module2", callback)
              .addState("calender", ["day", "week", "month"]);
  
      }).controller("testControl2", function($scope, checkUrl) {
  
          $scope.addSecond = function() {
  
              checkUrl.goState("module2", "calender", ["yes", "no", "maybe"]);
          }
      });
  </code></pre>
  
  <p>So it's injected, and in the config I call the provider and set a new modules with states. In the controller I just call goState. This works great when its just by itself. The issue is when I add a separate module in doing the same. I have a fiddle here showing the problem - </p>
  
  <p><a href="https://jsfiddle.net/7hn3ovgz/1/" rel="nofollow">https://jsfiddle.net/7hn3ovgz/1/</a></p>
  
  <p>So - I like to test this in my own browser window but fiddle seems to be the easiest way to share this. It will not change the actual url in the browser but it will still log all the effects.</p>
  
  <p>Basically what I think is happening is when I click to change state in a module, it fires it twice and looks for the state in the other module too (which isn't there). My desired effect was that ALL modules setting a config would be all in one place. So when you do the .set - it just adds the object into a variable called currentModules in the provider. It seems like the configs are setting separate instances (like a closure) of this, instead of pushing all the config set() into one big object for reference.</p>
  
  <p>Apologies if this is unclear, hopefully the fiddle will show clearly enough, and thank you for taking the time to read.</p>