@@ -46,7 +46,9 @@ In the meantime, you can override the height to fit with your application in you
46
46
<file name="app.js">
47
47
var app = angular.module('app', ['ngTouch', 'ui.grid', 'ui.grid.exporter', 'ui.grid.selection']);
48
48
49
- app.controller('MainCtrl', ['$scope', '$http', '$interval', '$q', function ($scope, $http, $interval, $q) {
49
+ app.controller('MainCtrl', function ($scope, $http, $interval, $q) {
50
+ var vm = this;
51
+
50
52
function fakeI18n(title){
51
53
return $q(function(resolve) {
52
54
$interval(function() {
@@ -55,7 +57,7 @@ In the meantime, you can override the height to fit with your application in you
55
57
});
56
58
}
57
59
58
- $scope .gridOptions = {
60
+ vm .gridOptions = {
59
61
exporterMenuCsv: false,
60
62
enableGridMenu: true,
61
63
gridMenuTitleFilter: fakeI18n,
@@ -74,30 +76,30 @@ In the meantime, you can override the height to fit with your application in you
74
76
}
75
77
],
76
78
onRegisterApi: function( gridApi ){
77
- $scope .gridApi = gridApi;
79
+ vm .gridApi = gridApi;
78
80
79
81
// interval of zero just to allow the directive to have initialized
80
82
$interval( function() {
81
83
gridApi.core.addToGridMenu( gridApi.grid, [{ title: 'Dynamic item', order: 100}]);
82
84
}, 0, 1);
83
85
84
86
gridApi.core.on.columnVisibilityChanged( $scope, function( changedColumn ){
85
- $scope .columnChanged = { name: changedColumn.colDef.name, visible: changedColumn.colDef.visible };
87
+ vm .columnChanged = { name: changedColumn.colDef.name, visible: changedColumn.colDef.visible };
86
88
});
87
89
}
88
90
};
89
91
90
92
$http.get('/data/100.json')
91
93
.then(function(response) {
92
- $scope .gridOptions.data = response.data;
94
+ vm .gridOptions.data = response.data;
93
95
});
94
- }] );
96
+ });
95
97
</file>
96
98
<file name="index.html">
97
- <div ng-controller="MainCtrl">
98
- <div id="grid1" ui-grid="gridOptions" ui-grid-exporter ui-grid-selection class="grid"></div>
99
- <div ng-if=' columnChanged' >
100
- Column Visibility Changed - name: {{ columnChanged.name }} visible: {{ columnChanged.visible }}
99
+ <div ng-controller="MainCtrl as $ctrl ">
100
+ <div id="grid1" ui-grid="$ctrl. gridOptions" ui-grid-exporter ui-grid-selection class="grid"></div>
101
+ <div ng-if="$ctrl. columnChanged" >
102
+ Column Visibility Changed - name: {{ $ctrl. columnChanged.name }} visible: {{ $ctrl. columnChanged.visible }}
101
103
</div>
102
104
</div>
103
105
</file>
0 commit comments