diff --git a/modules/angular2/src/core/debug/debug_element.ts b/modules/angular2/src/core/debug/debug_element.ts index 5f65f6fc88..34e716f23f 100644 --- a/modules/angular2/src/core/debug/debug_element.ts +++ b/modules/angular2/src/core/debug/debug_element.ts @@ -5,7 +5,7 @@ import {unimplemented} from 'angular2/src/core/facade/exceptions'; import {DOM} from 'angular2/src/core/dom/dom_adapter'; import {ElementInjector} from 'angular2/src/core/linker/element_injector'; -import {AppView} from 'angular2/src/core/linker/view'; +import {AppView, ViewType} from 'angular2/src/core/linker/view'; import {internalView} from 'angular2/src/core/linker/view_ref'; import {ElementRef, ElementRef_} from 'angular2/src/core/linker/element_ref'; @@ -107,7 +107,7 @@ export class DebugElement_ extends DebugElement { get componentViewChildren(): DebugElement[] { var shadowView = this._parentView.getNestedView(this._boundElementIndex); - if (!isPresent(shadowView)) { + if (!isPresent(shadowView) || shadowView.proto.type !== ViewType.COMPONENT) { // The current element is not a component. return []; } diff --git a/modules/angular2/test/core/debug/debug_element_spec.ts b/modules/angular2/test/core/debug/debug_element_spec.ts index 4a0042fc09..42e76c8d12 100644 --- a/modules/angular2/test/core/debug/debug_element_spec.ts +++ b/modules/angular2/test/core/debug/debug_element_spec.ts @@ -18,7 +18,7 @@ import {DOM} from 'angular2/src/core/dom/dom_adapter'; import {PromiseWrapper, EventEmitter, ObservableWrapper} from 'angular2/src/core/facade/async'; -import {Injectable, NgFor} from 'angular2/core'; +import {Injectable, NgFor, NgIf} from 'angular2/core'; import {By, Scope} from 'angular2/src/core/debug'; import { @@ -61,14 +61,24 @@ class ChildComp { constructor() { this.childBinding = 'Original'; } } +@Component({selector: 'cond-content-comp', viewProviders: [Logger]}) +@View({ + template: `