title: Circular Dependencies for a web app using backbone.marionette and requireJs
body: <p>I am in the following situation.</p>
  
  <p>I am using requireJs to loads module and I don't want to use global variables.</p>
  
  <p>The main.js is responsible to load the router.<br>
  Then the router loads the app and the app loads several subApps.  </p>
  
  <p>After everything has been initialised, the subApps needs the <code>router</code> for making <code>router.navigate</code>.</p>
  
  <p>Here the schema:</p>
  
  <pre><code>main.js -&gt; router -&gt; app -&gt; subApp -&gt; router
  </code></pre>
  
  <p>Then I have a problem of Circular Dependencies and for that reason the router in subApp will be undefined.</p>
  
  <p>What is the best way to reorganise my code or to fix this problem?
  Are there some example about this?</p>