Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Portal type application with AngularJS (Multiple Independent apps)

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.

  1. Each app can be developed and deployed independent of each other.
  2. They share a common authentication service, they can share common libraries (directives, filters etc).
  3. Only one app will be visible and active at any given time. The scope of each sub-app is isolated from each other.
  4. 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)
  5. 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).

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.

like image 982
Ketan Avatar asked Dec 08 '12 05:12

Ketan


People also ask

How to develop a single page application using AngularJS?

How to Develop a Single Page Application Using AngularJS? Step 1: Create a Module. We all know that AngularJS follows MVC architecture. Hence, every AngularJS application contains a module comprising of ... Step 2: Define a Simple Controller app.controller ('FirstController', function ($scope) { ...

What are the advantages of multiple angular apps in one project?

Angular 9, Angular 10 , Angular 11 There are several advantages of having Multiple Angular Apps in One Project. One is you do not have to run the time consuming npm install for every app. The node_modules folder is shared with all the other apps saving disk space. All the apps can be updated to the next version easily.

How to create a single source-control repository in angular?

A single source-control repository (such as git ). We create a new app using the ng new <new> Angular CLI command. It creates and workspace with an initial Angular app with the name <new> in the src folder. The createApplication="false" option introduced in Angular 7 now stops the creation of the initial app. It only creates the workspace

How to create a multi-project workspace in Angular 6?

The Angular CLI since version 6 allows us to create a multi-project workspace to manage multiple Angular apps. We do that first by creating an empty workspace. A Workspace is a collection of Angular apps, projects, or libraries. Later we can add multiple projects to the workspace. Applies to: Angular 6 to the latest edition i.e. Angular 8.


1 Answers

There is no easy answer to your (rather open) question, but regarding the $route and ngView limitations, I have been having great success employing a technique derived from this: http://www.bennadel.com/blog/2420-Mapping-AngularJS-Routes-Onto-URL-Parameters-And-Client-Side-Events.htm

like image 71
Tiago Roldão Avatar answered Oct 20 '22 01:10

Tiago Roldão