diff --git a/docs/content/error/ngRepeat/badident.ngdoc b/docs/content/error/ngRepeat/badident.ngdoc index 9f095cf57be4..039d63c4dcbe 100644 --- a/docs/content/error/ngRepeat/badident.ngdoc +++ b/docs/content/error/ngRepeat/badident.ngdoc @@ -16,6 +16,8 @@ Reserved names include: - `this` - `undefined` - `$parent` + - `$id` + - `$root` - `$even` - `$odd` - `$first` diff --git a/src/ng/directive/ngRepeat.js b/src/ng/directive/ngRepeat.js index 6cac08b6fb6a..82466a7c8d5e 100644 --- a/src/ng/directive/ngRepeat.js +++ b/src/ng/directive/ngRepeat.js @@ -267,7 +267,7 @@ var ngRepeatDirective = ['$parse', '$animate', function($parse, $animate) { var keyIdentifier = match[2]; if (aliasAs && (!/^[$a-zA-Z_][$a-zA-Z0-9_]*$/.test(aliasAs) || - /^(null|undefined|this|\$index|\$first|\$middle|\$last|\$even|\$odd|\$parent)$/.test(aliasAs))) { + /^(null|undefined|this|\$index|\$first|\$middle|\$last|\$even|\$odd|\$parent|\$root|\$id)$/.test(aliasAs))) { throw ngRepeatMinErr('badident', "alias '{0}' is invalid --- must be a valid JS identifier which is not a reserved name.", aliasAs); } diff --git a/test/ng/directive/ngRepeatSpec.js b/test/ng/directive/ngRepeatSpec.js index f5cfdf6d3890..f0f54b8f6b8e 100644 --- a/test/ng/directive/ngRepeatSpec.js +++ b/test/ng/directive/ngRepeatSpec.js @@ -474,6 +474,8 @@ describe('ngRepeat', function() { 'this', 'undefined', '$parent', + '$root', + '$id', '$index', '$first', '$middle',