Skip to content

Commit 4f6f5e6

Browse files
committed
FIX regexp
The regexp being used fails if the datatable is not initialised with empty data. When the table is empty, we try to match an expression that looks like this : `<!-- ngRepeat: v in a.b --><!-- end ngRepeat: v in a.b -->` ngRepeatAttr is then correctly matched to `a.b` When the table is NOT empty, then the expression looks more like this : `<!-- ngRepeat: v in a.b --><tr ng-repeat="v in a.b" class="ng-scope">...` ngRepeatAttr is then set to `a.b"` (with a quote at the end of the expression) We should use a `.+?` as a non-greedy version of `.+` to match only the expression inside the comment
1 parent 57ca589 commit 4f6f5e6

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/angular-datatables.renderer.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@
5353
expression = $elem.find('tbody').html(),
5454
// Find the resources from the comment <!-- ngRepeat: item in items --> displayed by angular in the DOM
5555
// This regexp is inspired by the one used in the "ngRepeat" directive
56-
match = expression.match(/^\s*.+\s+in\s+(\S*)\s*/),
56+
match = expression.match(/^\s*.+?\s+in\s+(\S*)\s*/),
5757
ngRepeatAttr = match[1];
5858

5959
if (!match) {

0 commit comments

Comments
 (0)