title: Portal type application with AngularJS (Multiple Independent apps)
body: <p>We are trying to create a portal type application with multiple / independent "sub-apps". Assuming that all sub-apps are written in Angular what is a good pattern to achieve the following goals.</p>
  
  <ol>
  <li>Each app can be developed and deployed independent of each other.</li>
  <li>They share a common authentication service, they can share common libraries (directives, filters etc).</li>
  <li>Only one app will be visible and active at any given time. The scope of each sub-app is isolated from each other.</li>
  <li>When the users goes between the sub-apps, the state is maintained as long as the user does not refresh the page or visit another static link. (I think this is built into Angular and no special effort maybe needed)</li>
  <li>Each sub-app will have more than one views (it will have its own menu). There will be a top menu based on what sub-apps are available. Ideally the top menu is dynamically build based on what sub-apps are deployed. Maybe there is a server side component to this (the server detects the folder structure etc and determines what apps are deployed and injects the necessary js code into the page).</li>
  </ol>
  
  <p>Given the fact that AngularJs does not have multi-level view structure, I was thinking of using multiple ng-app declarations on different divs and then using $window scope to store the key of the active app and hide the ones which are not active. </p>