Wijmo 5 [Flex Grid]

Call back function for items source

HTML

<link rel="stylesheet" href="http://cdn.wijmo.com/5.latest/styles/wijmo.min.css">
<link rel="stylesheet" href="http://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css">
<script src="http://code.jquery.com/jquery-2.2.4.min.js"></script>
<script src="http://cdn.wijmo.com/5.latest/controls/wijmo.min.js"></script>
<script src="http://cdn.wijmo.com/5.latest/controls/wijmo.grid.min.js"></script>
<script src="http://cdn.wijmo.com/5.latest/controls/wijmo.grid.detail.min.js"></script>
<script src="http://cdn.wijmo.com/5.latest/interop/angular/wijmo.angular.min.js"></script>
<div ng-app="app">
        <div ng-controller="appCtrl">
            <wj-flex-grid items-source="data" control="flexgrid" >                               
                <wj-flex-grid-detail max-height="300" detail-visibility-mode="ExpandSingle" control="dp">                  
                    <wj-flex-grid items-source="detail" headers-visibility="Column" control="flex" style="height:200px;"></wj-flex-grid>
                </wj-flex-grid-detail>
            </wj-flex-grid>
        </div>
    </div>

JavaScript

var app = angular.module('app', ['wj']);
        app.controller('appCtrl', function ($scope,$http) {
            var countries = 'US,Germany,U K,Japan,Italy,Greece'.split(','), data = [];
            for (var i = 0; i < 10; i++) {
                data.push({
                    id: i,
                    country: countries[i % countries.length],
                    date: new Date(2014, i % 12, i % 28),
                    amount: Math.random() * 10000,
                    active: i % 4 == 0
                });
            }
            $scope.data = new wijmo.collections.CollectionView(data);
            $scope.detail = null;
            function get(callback) {              
                  $http.get('http://www.w3schools.com/angular/customers.php').then(function (response) {
                  callback(response.data.records);                   
                });                
            }
            function callback(value) {
                $scope.detail= value;
            }
             $scope.$watch('flexgrid', function () {
                var flex = $scope.flexgrid;
                if (flex) {
                    console.log(flex.rowHeaders.hostElement);
                    flex.rowHeaders.hostElement.addEventListener('click', function () {
                        alert('You Click ' + flex.selectedRows[0].index + ' row. ');
                        get(callback);
                    }, true);
                }
            });
        });