First of all, the idea behind AngularJS is to avond situations like that.
In terms of AngularJS you woud probably be better off rethinking your application and use a directive to encapsulate the code you are currently writing in the script tags.
However, that being said, there is a way to access a scope like this:
var $element = $('#elementId');
var scope = angular.element($element).scope();
You can read the documentation for more details.
But as said, it is not a recommended practice in most cases.
Hope that helps!
Update after OP posted jsFiddle:
I created a working jsFiddle for your convenience at http://jsfiddle.net/jvandemo/hYnBa/1/
Since your example has a simple div
with an ng-controller
attribute, you can access the scope like this:
<script>
$(document).ready(function(){
var $element = $('div[ng-controller="AdminEventsCtrl"]');
var scope = angular.element($element).scope();
console.dir(scope);
});
</script>
Here's what happens:
- You select the element (in this case by using jQuery)
- You wrap the element as an AngularJS element (exposing extra methods on the element)
- You call the
scope()
method on the element
- You can then access the scope properties e.g.
scope.totals
Hope that helps!