0

I'm trying to interact with a website using an userscript, but I don't know what's the cleanest possible solution for an outside source to detect the internal $viewContentLoaded event, because it does not bubble to the window object.

I tried using dirty workarounds, but I'm wondering how one could achieve a clean window level detection of the $viewContentLoaded event. The website in question is using 1.3.14 according to window.angular.version

4
  • Can you modify the Angular app? Commented Feb 23, 2017 at 20:39
  • you should use caution when attempting to do this. it is extremely easy to make changes outside angular's context which angular is not aware of, putting the app into a state where it does not properly update it's information, leading to the page (and your script, potentially) providing inaccurate information. Commented Feb 23, 2017 at 20:41
  • Use angular.element(HTMLelement).scope() to get access to an Angular app scope. See AngularJS angular.element API Reference - jqLite Extras. Commented Feb 24, 2017 at 4:33
  • @Will Do you mean whether the app is hosted by me? In that case, no, it's someone else's website. @georgeawg I'm not quite familiar with Angular. When should I use angular.element(document.querySelector("body>.ng-scope")).scope().$on to attach a listener to the target element? Commented Feb 24, 2017 at 16:30

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.