Skip to content
This repository was archived by the owner on Feb 22, 2018. It is now read-only.

Commit 0e4cb8e

Browse files
committed
fix(tagging compiler): Transclusions with an existing ElementBinder
1 parent b71a500 commit 0e4cb8e

File tree

2 files changed

+12
-6
lines changed

2 files changed

+12
-6
lines changed

lib/core_dom/tagging_compiler.dart

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ class TaggingCompiler implements Compiler {
2121
TaggedElementBinder directParentElementBinder,
2222
List<TaggedElementBinder> elementBinders) {
2323
assert(parentElementBinderOffset != null);
24+
assert(parentElementBinderOffset < elementBinders.length);
2425
if (domCursor.current == null) return null;
2526

2627
do {
@@ -41,8 +42,7 @@ class TaggingCompiler implements Compiler {
4142
if (elementBinder.hasTemplate) {
4243
elementBinder.templateViewFactory = _compileTransclusion(
4344
elementBinders, domCursor, templateCursor, elementBinder.template,
44-
elementBinder.templateBinder, directives,
45-
parentElementBinderOffset);
45+
elementBinder.templateBinder, directives);
4646
}
4747
}
4848

@@ -110,8 +110,7 @@ class TaggingCompiler implements Compiler {
110110
NodeCursor domCursor, NodeCursor templateCursor,
111111
DirectiveRef directiveRef,
112112
ElementBinder transcludedElementBinder,
113-
DirectiveMap directives,
114-
int parentElementBinderOffset) {
113+
DirectiveMap directives) {
115114
var anchorName = directiveRef.annotation.selector +
116115
(directiveRef.value != null ? '=' + directiveRef.value : '');
117116
var viewFactory;
@@ -121,7 +120,7 @@ class TaggingCompiler implements Compiler {
121120
var domCursorIndex = domCursor.index;
122121
var elementBinders = [];
123122
_compileView(domCursor, transcludeCursor, transcludedElementBinder,
124-
directives, parentElementBinderOffset, null, elementBinders);
123+
directives, -1, null, elementBinders);
125124

126125
viewFactory = new TaggingViewFactory(transcludeCursor.elements,
127126
elementBinders, _perf, _expando);

test/core_dom/compiler_spec.dart

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ void main() {
9292
expect(element.html()).toEqual('<!--ANCHOR: [ng-repeat]=item in items-->');
9393
}));
9494

95-
it('should compile a repeater as a child', () {
95+
it('should compile a text child of a basic repeater', () {
9696
var element = $(_.compile(
9797
'<div ng-show="true">' +
9898
'<span ng-repeat="r in [1, 2]">{{r}}</span>' +
@@ -101,6 +101,13 @@ void main() {
101101
expect(element.text()).toEqual('12');
102102
});
103103

104+
it('should compile a text child of a repeat with a directive', () {
105+
_.compile(
106+
'<div ng-show="true">'
107+
'<span ng-show=true" ng-repeat="r in robots">{{r}}</span>'
108+
'</div>');
109+
});
110+
104111
it('should compile repeater with children', inject((Compiler $compile) {
105112
var element = $(_.compile('<div><div ng-repeat="item in items"><div ng-bind="item"></div></div></div>'));
106113

0 commit comments

Comments
 (0)