Search code examples
javascriptangularjsangularjs-ng-includewijmo5

How get FlexGrid control inside a ng-include file?


I'm building a SPA with Angularjs and Wijmo 5.

I've inserted a Wijmo FlexGrid inside a partial file, then I've included it to the parent page using ng-include. The parent page is also an partial file: it's inside the ng-view.

<wj-flex-grid id="myFlexGrid"
              control="myFlexGrid"></wj-flex-grid>

The problem is that I can't reach the FlexGrid control. When i try to declare the flex control, it throws a error: Cannot read property 'selection' of undefined.

var flex = $scope.myFlexGrid;
var myVar = flex.selection;

How can I reach the FlexGrid control?


Solution

  • ng-include creates a child scope so any directive used within it will be on child scope. You should create flex grid like this -

    <wj-flex-grid id="myFlexGrid" control="file.myFlexGrid" items-source="file.data" loaded-rows="loadedRows()">
    </wj-flex-grid>
    

    Here is working fiddle.