Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Multiple *Window* App using Angular

Tags:

angularjs

We are designing a complex web app which runs in multiple browser windows .will use AngularJS

(note it has to look/feel like one app – just that it is spread across several browser windows)

Javascript allows a parent window to reference the objects on other windows as long as the parent retains references to the other windows. Those objects can be accessed either by the native accessors or, for example, by jQuery.

Is a multi-window app something that's been done with Angular before? How would such an app be structured to be scalable?

(I have seen the big 'angular-app' reference app which is a template for large scale apps (if I could only get it working!) but haven't found anything on using multiple browser windows...

like image 664
Danny Avatar asked Dec 25 '12 06:12

Danny


1 Answers

Probably not the answer you're looking for, but from my experience w/ AngularJS it seems what you are looking for in an anti-pattern for angular. Specifically, angular is big on scoping - so a controller and view would only 'know' about its own stuff. Any other controllers/views on the same page, or other windows, etc. wouldn't necessarily have references to each other. Rather, an application on a page would have a $rootScope which can serve as a message bus w/ $emit(), on$().

So, perhaps look at this as loosely coupled parts with a centralized message bus that figures out which windows get what events. Then each part (app/controller/view) is just responding to those events.

Note: We had a test app that simulated multiple UIWebViews in a mobile app by hosting each angular app in and iFrames and used this approach successfully. Very composable, very testable. HTH

like image 139
Mark Nadig Avatar answered Oct 12 '22 00:10

Mark Nadig