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>Trying to add attribute..</h1>

  <wj-flex-grid control="flex" items-source="data" can-customize-hide>
    <wj-flex-grid-column can-hide="true" header="Country" binding="country"></wj-flex-grid-column>
    <wj-flex-grid-column can-hide="false" header="Sales" binding="sales"></wj-flex-grid-column>
    <wj-flex-grid-column can-hide="hideValueInController" header="Expenses" binding="expenses"></wj-flex-grid-column>
    <wj-flex-grid-column can-hide="false" header="Downloads" binding="downloads"></wj-flex-grid-column>
  </wj-flex-grid>

</div>

CSS

.wj-flexgrid {
   height: 150px;
   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) {

  $scope.hideValueInController = true;
  // create some random data
  var countries = 'US,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.c = false;
  // expose data as a CollectionView to get events
  $scope.data = new wijmo.collections.CollectionView(data);
});

app.directive('canCustomizeHide', function($log) {
  console.log('here');
  return {
    require: 'wjFlexGrid',
    link: function(scope, el, attr) {
      // Here I want to add a "canHide" proiperty to the columndefinition, 
      // by extending the Column in the most 'correct' way possible.
      if (el.length > 0) {
        for (var i = 0; i < el.length; i++) {
          var curFlex = el[i];
          var childCols = curFlex.children;

          var colNum = 0;
          for (var j = 0; j < childCols.length; j++) {
            var childCol = childCols[j];
            if (!(childCol['_elemCntrl'] && childCol.classList.contains('wjGridColumn')) || colNum >= curFlex['$WJ-CTRL'].columns.length) {
              continue;
            }
            if (childCol.attributes['can-hide'] && scope[childCol.attributes['can-hide'].nodeValue] != undefined) {
              childCol.attributes['can-hide'].nodeValue = scope[childCol.attributes['can-hide'].nodeValue];
            }
            if (childCol.attributes['can-hide'] && childCol.attributes['can-hide'].nodeValue == "true") {

              if (curFlex['$WJ-CTRL'].columns[colNum]) {
                var colRef = curFlex['$WJ-CTRL'].columns[colNum];
                //do something with col ref with can-hide value=true
                console.log('do something with col-ref',...