X Tutup
Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion modules/angular2/src/render/dom/view/element_binder.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import {AST} from 'angular2/change_detection';
import {List, ListWrapper} from 'angular2/src/facade/collection';
import {isPresent} from 'angular2/src/facade/lang';

export class DomElementBinder {
textNodeIndices: List<number>;
Expand All @@ -23,7 +24,7 @@ export class DomElementBinder {
this.eventLocals = eventLocals;
this.localEvents = localEvents;
this.globalEvents = globalEvents;
this.hasNativeShadowRoot = hasNativeShadowRoot;
this.hasNativeShadowRoot = isPresent(hasNativeShadowRoot) ? hasNativeShadowRoot : false;
}
}

Expand Down
2 changes: 1 addition & 1 deletion modules/angular2/src/render/dom/view/proto_view_merger.ts
Original file line number Diff line number Diff line change
Expand Up @@ -339,7 +339,7 @@ function updateElementBinderTextNodeIndices(elementBinder: DomElementBinder,
eventLocals: null,
localEvents: [],
globalEvents: [],
hasNativeShadowRoot: null
hasNativeShadowRoot: false
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this field strictly a boolean or it has three states - null | false | true?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you set it to false in the constructor, like

onlySelf = isPresent(onlySelf) ? onlySelf : false;

});
} else {
result = new DomElementBinder({
Expand Down
19 changes: 19 additions & 0 deletions modules/angular2/test/core/compiler/projection_integration_spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,25 @@ export function main() {
});
}));

it('should support projecting text interpolation to a non bound element',
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async) => {
tcb.overrideView(
Simple,
new viewAnn.View(
{template: 'SIMPLE(<div><ng-content></ng-content></div>)', directives: []}))
.overrideView(
MainComp,
new viewAnn.View({template: '<simple>{{text}}</simple>', directives: [Simple]}))
.createAsync(MainComp)
.then((main) => {

main.componentInstance.text = 'A';
main.detectChanges();
expect(main.nativeElement).toHaveText('SIMPLE(A)');
async.done();
});
}));

it('should not show the light dom even if there is no content tag',
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async) => {
tcb.overrideView(MainComp,
Expand Down
X Tutup