diff options
| author | Tobias Bosch | 2013-11-14 13:50:36 -0800 |
|---|---|---|
| committer | Vojta Jina | 2013-11-14 20:59:50 -0800 |
| commit | 90f87072e83234ae366cfeb3c281503c31dad738 (patch) | |
| tree | d969b74c0fe993900bc91e3e9f1d8004d238ac2c /src/ng/directive/ngRepeat.js | |
| parent | c785918cbd245cc8ecf9a38e373b121c4e68a55b (diff) | |
| download | angular.js-90f87072e83234ae366cfeb3c281503c31dad738.tar.bz2 | |
fix($compile): accessing controllers of transcluded directives from children
Additional API (backwards compatible)
- Injects `$transclude` (see directive controllers) as 5th argument to directive link functions.
- `$transclude` takes an optional scope as first parameter that overrides the
bound scope.
Deprecations:
- `transclude` parameter of directive compile functions (use the new parameter for link functions instead).
Refactorings:
- Don't use comment node to temporarily store controllers
- `ngIf`, `ngRepeat`, ... now all use `$transclude`
Closes #4935.
Diffstat (limited to 'src/ng/directive/ngRepeat.js')
| -rw-r--r-- | src/ng/directive/ngRepeat.js | 6 |
1 files changed, 2 insertions, 4 deletions
diff --git a/src/ng/directive/ngRepeat.js b/src/ng/directive/ngRepeat.js index c7d0c005..a5614bf4 100644 --- a/src/ng/directive/ngRepeat.js +++ b/src/ng/directive/ngRepeat.js @@ -201,8 +201,7 @@ var ngRepeatDirective = ['$parse', '$animate', function($parse, $animate) { priority: 1000, terminal: true, $$tlb: true, - compile: function(element, attr, linker) { - return function($scope, $element, $attr){ + link: function($scope, $element, $attr, ctrl, $transclude){ var expression = $attr.ngRepeat; var match = expression.match(/^\s*(.+)\s+in\s+(.*?)\s*(\s+track\s+by\s+(.+)\s*)?$/), trackByExp, trackByExpGetter, trackByIdExpFn, trackByIdArrayFn, trackByIdObjFn, @@ -364,7 +363,7 @@ var ngRepeatDirective = ['$parse', '$animate', function($parse, $animate) { // jshint bitwise: true if (!block.startNode) { - linker(childScope, function(clone) { + $transclude(childScope, function(clone) { clone[clone.length++] = document.createComment(' end ngRepeat: ' + expression + ' '); $animate.enter(clone, null, jqLite(previousNode)); previousNode = clone; @@ -377,7 +376,6 @@ var ngRepeatDirective = ['$parse', '$animate', function($parse, $animate) { } lastBlockMap = nextBlockMap; }); - }; } }; }]; |
