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): Sibling templates
Browse files Browse the repository at this point in the history
  • Loading branch information
jbdeboer committed Mar 17, 2014
1 parent 79fe1f8 commit 167b490
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 1 deletion.
2 changes: 1 addition & 1 deletion lib/core_dom/tagging_compiler.dart
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ class TaggingCompiler implements Compiler {
(templateCursor.current.parentNode as dom.Element).classes.add('ng-binding');
}
directParentElementBinder.addText(
new TaggedTextBinder(elementBinder, 0 /* TODO */));
new TaggedTextBinder(elementBinder, domCursor.index));
} else if(!(node.parentNode != null &&
templateCursor.current.parentNode != null)) {
// Always add an elementBinder for top-level text.
Expand Down
1 change: 1 addition & 0 deletions lib/directive/ng_repeat.dart
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,7 @@ class NgRepeatDirective {
this.filters);

set expression(value) {
assert(value != null);
_expression = value;
if (_watch != null) _watch.remove();
Match match = _SYNTAX.firstMatch(_expression);
Expand Down
11 changes: 11 additions & 0 deletions test/core_dom/compiler_spec.dart
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,17 @@ void main() {
'</div>');
});

it('should compile a sibling template directive', () {
var element = $(_.compile(
'<div ng-model="selected">'
'<option value="">blank</option>'
'<div ng-repeat="value in [1,2]" ng-value="value">{{value}}</div>'
'</div>'));

_.rootScope.apply();
expect(element.text()).toEqual('blank12');
});

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 167b490

Please sign in to comment.