I know it sounds like a repost but I still have to ask how I can do this in my project.
I have a class in PHP handling API-calls and receiving data. This received JSON data I would like to pass to Angular and present it in UI-Grid. Furthermore the page that I'm working with is in PHP and echoes the HTML for the Angular grid. How can I make it use the previously loaded data from the API?
I've seen many answers to other peoples very similar problems but haven't been able to make them work.
EDIT:
So inside the php I have:
<div ng-controller="DataController as dataCtrl">
<script type="text/javascript">
var data = <?php echo json_encode(apicall("dummyarg")); ?>;
//PASS TO ANGULAR
//$scope.data = $window.data; doesnt work
</script>
</div>
And in js I have:
(function() {
var app = angular.module('table', ['ngTouch', 'ui.grid']);
app.controller("DataController", ["$scope", '$window', function($scope, $window){
$scope.data = {};
}]);
})();