From 4f6f5e68f09863a900aada1585884615b7770a49 Mon Sep 17 00:00:00 2001 From: David Gageot Date: Fri, 17 Oct 2014 13:20:11 +0200 Subject: [PATCH] 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 : `` ngRepeatAttr is then correctly matched to `a.b` When the table is NOT empty, then the expression looks more like this : `...` 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 --- src/angular-datatables.renderer.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/angular-datatables.renderer.js b/src/angular-datatables.renderer.js index 55d8502b3..84ab6c34a 100644 --- a/src/angular-datatables.renderer.js +++ b/src/angular-datatables.renderer.js @@ -53,7 +53,7 @@ expression = $elem.find('tbody').html(), // Find the resources from the comment displayed by angular in the DOM // This regexp is inspired by the one used in the "ngRepeat" directive - match = expression.match(/^\s*.+\s+in\s+(\S*)\s*/), + match = expression.match(/^\s*.+?\s+in\s+(\S*)\s*/), ngRepeatAttr = match[1]; if (!match) {