diff --git a/packages/core/test/acceptance/query_spec.ts b/packages/core/test/acceptance/query_spec.ts
index c269578e39..12a75203a1 100644
--- a/packages/core/test/acceptance/query_spec.ts
+++ b/packages/core/test/acceptance/query_spec.ts
@@ -177,7 +177,7 @@ describe('query logic', () => {
it('should support ViewChild query inherited from undecorated superclasses', () => {
class MyComp {
- @ViewChild('foo') foo: any;
+ @ViewChild('foo', {static: false}) foo: any;
}
@Component({selector: 'sub-comp', template: '
'})
@@ -193,7 +193,7 @@ describe('query logic', () => {
it('should support ViewChild query inherited from undecorated grand superclasses', () => {
class MySuperComp {
- @ViewChild('foo') foo: any;
+ @ViewChild('foo', {static: false}) foo: any;
}
class MyComp extends MySuperComp {}
@@ -493,7 +493,7 @@ describe('query logic', () => {
it('should support ContentChild query inherited from undecorated superclasses', () => {
class MyComp {
- @ContentChild('foo') foo: any;
+ @ContentChild('foo', {static: false}) foo: any;
}
@Component({selector: 'sub-comp', template: ''})
@@ -502,7 +502,7 @@ describe('query logic', () => {
@Component({template: ''})
class App {
- @ViewChild(SubComp) subComp !: SubComp;
+ @ViewChild(SubComp, {static: false}) subComp !: SubComp;
}
TestBed.configureTestingModule({declarations: [App, SubComp]});
@@ -514,7 +514,7 @@ describe('query logic', () => {
it('should support ContentChild query inherited from undecorated grand superclasses', () => {
class MySuperComp {
- @ContentChild('foo') foo: any;
+ @ContentChild('foo', {static: false}) foo: any;
}
class MyComp extends MySuperComp {}
@@ -525,7 +525,7 @@ describe('query logic', () => {
@Component({template: ''})
class App {
- @ViewChild(SubComp) subComp !: SubComp;
+ @ViewChild(SubComp, {static: false}) subComp !: SubComp;
}
TestBed.configureTestingModule({declarations: [App, SubComp]});
@@ -557,7 +557,7 @@ describe('query logic', () => {
`
})
class App {
- @ViewChild(SubComp) subComp !: SubComp;
+ @ViewChild(SubComp, {static: false}) subComp !: SubComp;
}
TestBed.configureTestingModule({declarations: [App, SubComp, SomeDir]});
@@ -592,7 +592,7 @@ describe('query logic', () => {
`
})
class App {
- @ViewChild(SubComp) subComp !: SubComp;
+ @ViewChild(SubComp, {static: false}) subComp !: SubComp;
}
TestBed.configureTestingModule({declarations: [App, SubComp, SomeDir]});
@@ -806,9 +806,10 @@ describe('query logic', () => {
`,
})
class TestComponent {
- @ViewChild(ViewContainerManipulatorDirective) vc !: ViewContainerManipulatorDirective;
- @ViewChild('tpl1') tpl1 !: TemplateRef;
- @ViewChild('tpl2') tpl2 !: TemplateRef;
+ @ViewChild(ViewContainerManipulatorDirective, {static: false})
+ vc !: ViewContainerManipulatorDirective;
+ @ViewChild('tpl1', {static: false}) tpl1 !: TemplateRef;
+ @ViewChild('tpl2', {static: false}) tpl2 !: TemplateRef;
@ViewChildren('foo') query !: QueryList;
}
@@ -878,9 +879,9 @@ describe('query logic', () => {
`,
})
class TestComponent {
- @ViewChild('tpl') tpl !: TemplateRef;
- @ViewChild('vi0') vi0 !: ViewContainerManipulatorDirective;
- @ViewChild('vi1') vi1 !: ViewContainerManipulatorDirective;
+ @ViewChild('tpl', {static: false}) tpl !: TemplateRef;
+ @ViewChild('vi0', {static: false}) vi0 !: ViewContainerManipulatorDirective;
+ @ViewChild('vi1', {static: false}) vi1 !: ViewContainerManipulatorDirective;
@ViewChildren('foo') query !: QueryList;
}
@@ -963,8 +964,8 @@ function initWithTemplate(compType: Type, template: string) {
@Component({selector: 'local-ref-query-component', template: ''})
class QueryComp {
- @ViewChild('viewQuery') viewChild !: any;
- @ContentChild('contentQuery') contentChild !: any;
+ @ViewChild('viewQuery', {static: false}) viewChild !: any;
+ @ContentChild('contentQuery', {static: false}) contentChild !: any;
@ViewChildren('viewQuery') viewChildren !: QueryList;
@ContentChildren('contentQuery') contentChildren !: QueryList;
diff --git a/packages/core/test/linker/query_integration_spec.ts b/packages/core/test/linker/query_integration_spec.ts
index 1f68c34363..41378a6245 100644
--- a/packages/core/test/linker/query_integration_spec.ts
+++ b/packages/core/test/linker/query_integration_spec.ts
@@ -752,7 +752,7 @@ describe('Query API', () => {
class AutoProjecting {
// TODO(issue/24571):
// remove '!'.
- @ContentChild(TemplateRef)
+ @ContentChild(TemplateRef, {static: false})
content !: TemplateRef;
// TODO(issue/24571):
@@ -784,7 +784,7 @@ describe('Query API', () => {
class AutoProjecting {
// TODO(issue/24571):
// remove '!'.
- @ContentChild(TemplateRef)
+ @ContentChild(TemplateRef, {static: false})
content !: TemplateRef;
// TODO(issue/24571):
@@ -839,7 +839,7 @@ class NeedsContentChild implements AfterContentInit, AfterContentChecked {
// TODO(issue/24571): remove '!'.
_child !: TextDirective;
- @ContentChild(TextDirective)
+ @ContentChild(TextDirective, {static: false})
set child(value) {
this._child = value;
this.logs.push(['setter', value ? value.text : null]);
@@ -856,7 +856,7 @@ class NeedsContentChild implements AfterContentInit, AfterContentChecked {
@Directive({selector: '[directive-needs-content-child]'})
class DirectiveNeedsContentChild {
// TODO(issue/24571): remove '!'.
- @ContentChild(TextDirective) child !: TextDirective;
+ @ContentChild(TextDirective, {static: false}) child !: TextDirective;
}
@Component({selector: 'needs-view-child', template: ``})
@@ -867,7 +867,7 @@ class NeedsViewChild implements AfterViewInit, AfterViewChecked {
// TODO(issue/24571): remove '!'.
_child !: TextDirective;
- @ViewChild(TextDirective)
+ @ViewChild(TextDirective, {static: false})
set child(value) {
this._child = value;
this.logs.push(['setter', value ? value.text : null]);
@@ -896,9 +896,9 @@ function createTestCmpAndDetectChanges(type: Type, template: string): Comp
@Component({selector: 'needs-static-content-view-child', template: ``})
class NeedsStaticContentAndViewChild {
// TODO(issue/24571): remove '!'.
- @ContentChild(TextDirective) contentChild !: TextDirective;
+ @ContentChild(TextDirective, {static: true}) contentChild !: TextDirective;
// TODO(issue/24571): remove '!'.
- @ViewChild(TextDirective) viewChild !: TextDirective;
+ @ViewChild(TextDirective, {static: true}) viewChild !: TextDirective;
}
@Directive({selector: '[dir]'})
@@ -917,13 +917,13 @@ class NeedsQuery {
@Component({selector: 'needs-four-queries', template: ''})
class NeedsFourQueries {
// TODO(issue/24571): remove '!'.
- @ContentChild(TextDirective) query1 !: TextDirective;
+ @ContentChild(TextDirective, {static: false}) query1 !: TextDirective;
// TODO(issue/24571): remove '!'.
- @ContentChild(TextDirective) query2 !: TextDirective;
+ @ContentChild(TextDirective, {static: false}) query2 !: TextDirective;
// TODO(issue/24571): remove '!'.
- @ContentChild(TextDirective) query3 !: TextDirective;
+ @ContentChild(TextDirective, {static: false}) query3 !: TextDirective;
// TODO(issue/24571): remove '!'.
- @ContentChild(TextDirective) query4 !: TextDirective;
+ @ContentChild(TextDirective, {static: false}) query4 !: TextDirective;
}
@Component({
@@ -1025,9 +1025,9 @@ class NeedsTpl {
{selector: 'needs-named-tpl', template: 'shadow
'})
class NeedsNamedTpl {
// TODO(issue/24571): remove '!'.
- @ViewChild('tpl') viewTpl !: TemplateRef