From c9705b755645a4bfe066243f2ba15a733c3787e1 Mon Sep 17 00:00:00 2001 From: Gias Kay Lee Date: Fri, 3 Jan 2014 00:22:10 +0800 Subject: fix(ngRepeat): allow for more flexible coding style in ngRepeat expression With this change it's possible to split the ng-repeat expression into multiple lines at any point in the expression where white-space is expected. Closes #5537 Closes #5598 --- src/ng/directive/ngRepeat.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/ng/directive/ngRepeat.js') diff --git a/src/ng/directive/ngRepeat.js b/src/ng/directive/ngRepeat.js index 0a2673ff..15f86baa 100644 --- a/src/ng/directive/ngRepeat.js +++ b/src/ng/directive/ngRepeat.js @@ -203,7 +203,7 @@ var ngRepeatDirective = ['$parse', '$animate', function($parse, $animate) { $$tlb: true, link: function($scope, $element, $attr, ctrl, $transclude){ var expression = $attr.ngRepeat; - var match = expression.match(/^\s*(.+)\s+in\s+([\r\n\s\S]*?)\s*(\s+track\s+by\s+(.+)\s*)?$/), + var match = expression.match(/^\s*([\s\S]+?)\s+in\s+([\s\S]+?)(?:\s+track\s+by\s+([\s\S]+?))?\s*$/), trackByExp, trackByExpGetter, trackByIdExpFn, trackByIdArrayFn, trackByIdObjFn, lhs, rhs, valueIdentifier, keyIdentifier, hashFnLocals = {$id: hashKey}; @@ -215,7 +215,7 @@ var ngRepeatDirective = ['$parse', '$animate', function($parse, $animate) { lhs = match[1]; rhs = match[2]; - trackByExp = match[4]; + trackByExp = match[3]; if (trackByExp) { trackByExpGetter = $parse(trackByExp); -- cgit v1.2.3