Skip to content

Commit 7938dd3

Browse files
committed
Merge pull request #39 from marknutter/master
fixed angular-table.js to work with angular 1.2+
2 parents 5f73237 + 7ad1959 commit 7938dd3

1 file changed

Lines changed: 5 additions & 2 deletions

File tree

src/main/webapp/js/lib/angular-table.js

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ angular.module('angular-table', [])
99
compile: function (tElement, tAttrs) {
1010
SortState.sortExpression = tAttrs.defaultSortColumn;
1111
TemplateStaticState.instrumentationEnabled = tAttrs.instrumentationEnabled;
12+
TemplateStaticState.modelName = tAttrs.model;
1213

1314
// find whatever classes were passed into the angular-table, and merge them with the built in classes for the container div
1415
tElement.addClass('angularTableContainer');
@@ -18,8 +19,9 @@ angular.module('angular-table', [])
1819
tElement.replaceWith(rowTemplate);
1920

2021
// return linking function
21-
return function(scope) {
22+
return function(scope, elem, attrs) {
2223
scope.parent = scope.$parent;
24+
2325
};
2426
},
2527
scope: {
@@ -316,7 +318,7 @@ angular.module('angular-table', [])
316318

317319
// add the ng-repeat and row selection click handler to each row
318320
rowTemplate = rowTemplate.replace('<tr',
319-
'<tr ng-repeat="row in model | orderBy:SortState.sortExpression:SortState.sortDirectionToColumnMap[SortState.sortExpression] | filter:filterQueryModel" ' +
321+
'<tr ng-repeat="row in ' + TemplateStaticState.modelName + ' | orderBy:SortState.sortExpression:SortState.sortDirectionToColumnMap[SortState.sortExpression] | filter:filterQueryModel" ' +
320322
selectedBackgroundColor + ngClick);
321323
}
322324

@@ -365,6 +367,7 @@ angular.module('angular-table', [])
365367
self.selectedRowColor = '';
366368
self.evenRowColor = '';
367369
self.oddRowColor = '';
370+
self.modelName = '';
368371

369372
return self;
370373
})

0 commit comments

Comments
 (0)