diff --git a/modules/@angular/core/src/metadata/di.ts b/modules/@angular/core/src/metadata/di.ts index c50e3b2f54..0622034b16 100644 --- a/modules/@angular/core/src/metadata/di.ts +++ b/modules/@angular/core/src/metadata/di.ts @@ -275,7 +275,7 @@ export const ContentChild: ContentChildDecorator = makePropDecorator( ['selector', undefined], { first: true, isViewQuery: false, - descendants: false, + descendants: true, read: undefined, } ], diff --git a/modules/@angular/core/test/linker/query_integration_spec.ts b/modules/@angular/core/test/linker/query_integration_spec.ts index 9bb7cea7ed..8d024cdc20 100644 --- a/modules/@angular/core/test/linker/query_integration_spec.ts +++ b/modules/@angular/core/test/linker/query_integration_spec.ts @@ -250,6 +250,17 @@ export function main() { expect(comp.textDirChild.text).toEqual('ca'); }); + it('should contain the first descendant content child', () => { + const template = '' + + '
' + + '
'; + const view = createTestCmpAndDetectChanges(MyComp0, template); + + const comp: NeedsContentChildWithRead = + view.debugElement.children[0].injector.get(NeedsContentChildWithRead); + expect(comp.textDirChild.text).toEqual('ca'); + }); + it('should contain the first view child', () => { const template = ''; const view = createTestCmpAndDetectChanges(MyComp0, template); diff --git a/tools/public_api_guard/core/testing/index.d.ts b/tools/public_api_guard/core/testing/index.d.ts index b0abcba28d..48d5255583 100644 --- a/tools/public_api_guard/core/testing/index.d.ts +++ b/tools/public_api_guard/core/testing/index.d.ts @@ -20,10 +20,10 @@ export declare class ComponentFixture { } /** @experimental */ -export declare var ComponentFixtureAutoDetect: OpaqueToken; +export declare const ComponentFixtureAutoDetect: OpaqueToken; /** @experimental */ -export declare var ComponentFixtureNoNgZone: OpaqueToken; +export declare const ComponentFixtureNoNgZone: OpaqueToken; /** @experimental */ export declare function discardPeriodicTasks(): void;