diff options
| author | Gias Kay Lee | 2014-01-03 00:22:10 +0800 |
|---|---|---|
| committer | Igor Minar | 2014-01-02 16:14:16 -0800 |
| commit | c9705b755645a4bfe066243f2ba15a733c3787e1 (patch) | |
| tree | f93771ddd101ab15bc51c8e1ca9a86e9b2bf3043 /src/ng/directive/ngRepeat.js | |
| parent | 53ec33f07fd75d76fc5109c0b24c86aa25219058 (diff) | |
| download | angular.js-c9705b755645a4bfe066243f2ba15a733c3787e1.tar.bz2 | |
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
Diffstat (limited to 'src/ng/directive/ngRepeat.js')
| -rw-r--r-- | src/ng/directive/ngRepeat.js | 4 |
1 files changed, 2 insertions, 2 deletions
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); |
