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

Commit

Permalink
fix(tagging compiler): Transclusions with an existing ElementBinder
Browse files Browse the repository at this point in the history
  • Loading branch information
jbdeboer committed Mar 17, 2014
1 parent b71a500 commit 0e4cb8e
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 6 deletions.
9 changes: 4 additions & 5 deletions lib/core_dom/tagging_compiler.dart
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ class TaggingCompiler implements Compiler {
TaggedElementBinder directParentElementBinder,
List<TaggedElementBinder> elementBinders) {
assert(parentElementBinderOffset != null);
assert(parentElementBinderOffset < elementBinders.length);
if (domCursor.current == null) return null;

do {
Expand All @@ -41,8 +42,7 @@ class TaggingCompiler implements Compiler {
if (elementBinder.hasTemplate) {
elementBinder.templateViewFactory = _compileTransclusion(
elementBinders, domCursor, templateCursor, elementBinder.template,
elementBinder.templateBinder, directives,
parentElementBinderOffset);
elementBinder.templateBinder, directives);
}
}

Expand Down Expand Up @@ -110,8 +110,7 @@ class TaggingCompiler implements Compiler {
NodeCursor domCursor, NodeCursor templateCursor,
DirectiveRef directiveRef,
ElementBinder transcludedElementBinder,
DirectiveMap directives,
int parentElementBinderOffset) {
DirectiveMap directives) {
var anchorName = directiveRef.annotation.selector +
(directiveRef.value != null ? '=' + directiveRef.value : '');
var viewFactory;
Expand All @@ -121,7 +120,7 @@ class TaggingCompiler implements Compiler {
var domCursorIndex = domCursor.index;
var elementBinders = [];
_compileView(domCursor, transcludeCursor, transcludedElementBinder,
directives, parentElementBinderOffset, null, elementBinders);
directives, -1, null, elementBinders);

viewFactory = new TaggingViewFactory(transcludeCursor.elements,
elementBinders, _perf, _expando);
Expand Down
9 changes: 8 additions & 1 deletion test/core_dom/compiler_spec.dart
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ void main() {
expect(element.html()).toEqual('<!--ANCHOR: [ng-repeat]=item in items-->');
}));

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

it('should compile a text child of a repeat with a directive', () {
_.compile(
'<div ng-show="true">'
'<span ng-show=true" ng-repeat="r in robots">{{r}}</span>'
'</div>');
});

it('should compile repeater with children', inject((Compiler $compile) {
var element = $(_.compile('<div><div ng-repeat="item in items"><div ng-bind="item"></div></div></div>'));

Expand Down

0 comments on commit 0e4cb8e

Please sign in to comment.