Skip to content
This repository has been archived by the owner on May 3, 2019. It is now read-only.

support multiple ng apps #5

Open
geddski opened this issue Nov 3, 2014 · 9 comments
Open

support multiple ng apps #5

geddski opened this issue Nov 3, 2014 · 9 comments

Comments

@geddski
Copy link

geddski commented Nov 3, 2014

in the case where you have multiple Angular apps on the page at once, like angularjs.org or when using overmind it would be sweet to be able to see the stats for all the apps.

@kentcdodds
Copy link
Owner

Good point. This should be supported. You can use the directive and it should work fine, but for the graph what kind of api would you prefer? Currently the api is:

showAngularStats({
  "position": "topleft",
  "digestTimeThreshold": 16,
  "autoload": false
});

How about:

showAngularStats({
  "element": document.querySelector('#my-ng-app1'),
  "position": "topleft",
  "digestTimeThreshold": 16,
  "autoload": false
});

Would you ever want to have more than one graph on a page? In this case, I imagine it should be labeled somehow. Open to ideas of what kind of an api would work well for what you're trying to accomplish :-)

@geddski
Copy link
Author

geddski commented Nov 3, 2014

yeah maybe allow multiple calls to showAngularStats(), so you can see many graphs at once. I like the idea of passing in the element, that would do the trick.

@kentcdodds
Copy link
Owner

I'm not used to having multiple ng-apps on a page. Just confirming, they have totally separate $rootScopes and (hence) digest cycles right? Otherwise calculating the average digest cycle length could be a problem.

@geddski
Copy link
Author

geddski commented Nov 3, 2014

yep separate

@kentcdodds
Copy link
Owner

I think this should be very easy. I'll let you know soon!

@kentcdodds
Copy link
Owner

Hmmm... What am I doing wrong here @geddski? http://jsbin.com/zerez/2/edit

@shedar
Copy link

shedar commented Nov 3, 2014

@kentcdodds something like this? http://jsbin.com/fucevaxuyu/2/edit
ng-app is limited to one instance per page, so you can either bootstrap it or make own directive to have two apps on same page

@kentcdodds
Copy link
Owner

Awesome. Thanks @shedar.

@kentcdodds
Copy link
Owner

This is going to require more work than I thought because ng-stats is a singleton that holds a bunch of state for performance reasons. I'll have to give some thought into restructuring it a bit...

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants