Angular: Empty Fiddle

http://angularjs.org/

by dshilkret

HTML

<script src="http://code.angularjs.org/angular-1.0.1.js"></script>
<p>Optimization for http://jsfiddle.net/38CrC/</p>
<p>Ref: http://stackoverflow.com/questions/17255728/how-to-access-angularjs-variable-from-template-script/17256042#17256042</p>
<br><br>
<div ng-controller="AdminEventsCtrl">
    <table>
        <thead>
            <tr>
                <th>Activity</th>
                <th>Total</th>
            </tr>
        </thead>
        <tbody>
            <tr ng-repeat="item in totals">
                <td>{{item.type}}</td>
                <td>{{item.count}}</td>
            </tr>
        </tbody>
    </table>
</div>
    <script>
        $(document).ready(function(){
            var $element = $('div[ng-controller="AdminEventsCtrl"]');
            var scope = angular.element($element).scope();
            console.dir(scope);
        });
    </script>

JavaScript

var myApp = angular.module('myApp', []);

function AdminEventsCtrl($scope) {
    var collection = [{
        type: 'a',
        count: 1
    }, {
        type: 'b',
        count: 5
    }, {
        type: 'c',
        count: 3
    }];
    $scope.totals = collection;
}