Wijmo 5 - AngularJS directives

HTML

<link rel="stylesheet" href="http://maxcdn.bootstrapcdn.com/bootstrap/3.2.0/css/bootstrap.min.css">
<link rel="stylesheet" href="http://cdn.wijmo.com/5.latest/styles/wijmo.min.css">
<script src="http://cdn.wijmo.com/5.latest/controls/wijmo.min.js"></script>
<script src="http://cdn.wijmo.com/5.latest/controls/wijmo.input.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.chart.min.js"></script>
<script src="http://cdn.wijmo.com/5.latest/interop/angular/wijmo.angular.min.js"></script>
<!-- mark this as an Angular application and give it a controller -->
<div ng-app="app" ng-controller="appCtrl" class="container">

  <h1>Hello Wijmo 5 and AngularJS!</h1>

  <p>autosize rows and word wrap in initialized event:</p>
  <wj-flex-grid items-source="data" initialized="init(s,e)">
    <wj-flex-grid-column header="Country" binding="country" ></wj-flex-grid-column>
    <wj-flex-grid-column header="Sales" binding="sales"></wj-flex-grid-column>
    <wj-flex-grid-column header="Expenses" binding="expenses"></wj-flex-grid-column>
    <wj-flex-grid-column header="Downloads" binding="downloads"></wj-flex-grid-column>
  </wj-flex-grid>
  <br>
<p>autosize rows in rowsloaded event and word-wrap during initialization:</p>
<div id="theGrid"></div>
  
</div>

CSS

.wj-flexgrid {
  height: 250px; 
  margin-top:10px;
 }
 .wj-flexchart {
   height: 300px;
 }

JavaScript

// define app, include Wijmo 5 directives
var app = angular.module('app', ['wj']);

// controller
app.controller('appCtrl', function($scope) {

  // create some random data
  var countries = 'US asdfasd fasdfasdf asdfasdfasd fasdfasdf asdfasdfasd fasdfas,Germany,UK,Japan,Italy,Greece'.split(','),
    data = [];
  for (var i = 0; i < countries.length; i++) {
    data.push({
      country: countries[i],
      downloads: Math.round(Math.random() * 20000),
      sales: Math.random() * 10000,
      expenses: Math.random() * 5000
    });
  }
	
  $scope.init=function(s,e){
  	//enable word wrap
  	s.columns.getColumn('country').wordWrap=true;
    //auto size rows
  	s.autoSizeRows(0,s.rows.length);
  }
  
  // expose data as a CollectionView to get events
  $scope.data = new wijmo.collections.CollectionView(data);
  
  var grid = new wijmo.grid.FlexGrid('#theGrid', {
        columns: [
        	{ binding: 'country', header: 'Country' ,wordWrap:true},
          { binding: 'sales', header: 'Sales' },
          { binding: 'expenses', header: 'Expenses' },
          { binding: 'downloads', header: 'Downloads', format: 'n0' }
				],
        autoGenerateColumns: false,
        selectionMode: wijmo.grid.SelectionMode.Row
    });
    grid.autoSizeRows(0,grid.rows.length);
    grid.loadedRows.addHandler((s,e)=>{
    	grid.autoSizeRows(0,grid.rows.length);
      console.log('done');
    });
   grid.itemsSource=data
  
});