I am using Angular to get output from controller and displaying with ng-bind. but I have a completely separate javascript which would need to use a value returned from angular.
In the code below the TestAppCtrl is called and the output shows correctly in the DOM but when I try to show in the alert box in the second script, it shows as undefined. I have tried multiple things even in my second script getting by element and getting inner html, etc but its always undefined.
<html ng-app="testApp">
<head><script src="lib/angular.min.js"></script> </head>
<body>
<div ng-controller="TestAppCtrl">
<div id="data"><span ng-bind="data" ></span></div>
</div>
<script>
var testApp = angular.module('testApp', []);
testApp.controller('TestAppCtrl', function ($scope) {
$scope.data = [1, 2, 4, 5];
});
</script>
<script>
window.alert(data);
</script>
</body>
</html>