Possible to have nested ng-apps?

1,192 views
Skip to first unread message

Scott Blanch

unread,
May 14, 2013, 7:23:48 PM5/14/13
to ang...@googlegroups.com
Where I work we want to create a framework that uses angularjs. This framework is going to display other contributors' widgets which will also be written in angularjs.  The issue that we are having is that the nested children ng-apps aren't having their controllers bound properly to them.

Is this at all possible? I do know that it is possible to bind multiple ng-apps on a page through bootstrapping. 

From what I have read about the philosophy of AngularJS this goes against what AngularJS is built for. I understand this. I am wondering though if it is possible for AngularJS to go to the next step at the moment. 

I have some sample code in regards to doing this. It is a github address because the main angularJS framework we want designed is using templates. Thus a server is needed in order to bypass the cross-site-scripting without dealing with permissions in the browser.


Thanks!

Sander Houttekier

unread,
Aug 12, 2013, 6:36:26 AM8/12/13
to ang...@googlegroups.com
Hey, scott,

I'm working on a similar idea and know for a fact that nesting apps will not work.
we are trying different options and have not yet been able to call 1 option as the definitive solution,
I'm just reaching out to hear if you have been able to make this work on your side?

I believe our case might not be 100% valid for you, because we can influence the other developers, to write their widget/apps following a set of guidelines we will lay down for them. So we don't have the problem that developers will use an ng-app within our ng-app. but we still need to find out how we can run custom developed widgets (using angular.modules) 

any ideas are welcome, when i have a solution working for us I will most certainly post it here, maybe you can use it, maybe you don't we'll see :)


Sander

Op woensdag 15 mei 2013 01:23:48 UTC+2 schreef Scott Blanch:

Matt Srum

unread,
Mar 20, 2014, 9:27:27 AM3/20/14
to ang...@googlegroups.com
Hi Sander,

Is there any update on what options you are researching?

Matt


Paweł Majewski

unread,
Jan 19, 2015, 12:28:32 PM1/19/15
to ang...@googlegroups.com
Please look at http://jsfiddle.net/majo44/h0t0dvq5/ 
This solution is using some special directive for isolation and bootstrapping is simple, and is working in simple case, I do not know it will work in complex

Pawel.

srihariprasath swaminathan

unread,
Jul 8, 2015, 1:31:49 AM7/8/15
to ang...@googlegroups.com
Hi Any output on the nesting thee angular applications. I am looking for a similar solution.

Sander Elias

unread,
Jul 8, 2015, 2:10:12 AM7/8/15
to ang...@googlegroups.com
Hi srihariprasath,

In angular 1.x it is not possible to boot more then 1 application in a single page. However, you can have as many modules as you like.
A way around this, is to make the root of your application a directive. A simple template directive with a controller will do just fine. Then nesting them is a simple as including the 'root' directive.

Regards
Sander
Reply all
Reply to author
Forward
0 new messages