From 471720749cffff8c45e514450887f003a932535a Mon Sep 17 00:00:00 2001 From: crisbeto Date: Tue, 22 Oct 2019 21:33:31 +0200 Subject: [PATCH] refactor: clean up explicit dynamic query usage Cleans up explicit usages of `static: false` in queries since it's no longer necessary. --- src/a11y-demo/a11y-demo.ts | 4 +- src/cdk-experimental/dialog/dialog.spec.ts | 6 +- .../popover-edit/popover-edit.spec.ts | 2 +- .../aria-describer/aria-describer.spec.ts | 8 +-- src/cdk/a11y/focus-trap/focus-trap.spec.ts | 14 ++-- src/cdk/bidi/directionality.spec.ts | 6 +- src/cdk/drag-drop/directives/drag.spec.ts | 58 +++++++-------- src/cdk/drag-drop/directives/drag.ts | 4 +- src/cdk/observers/observe-content.spec.ts | 2 +- src/cdk/overlay/overlay-directives.spec.ts | 10 +-- src/cdk/overlay/overlay.spec.ts | 2 +- src/cdk/scrolling/scroll-dispatcher.spec.ts | 6 +- src/cdk/scrolling/scrollable.spec.ts | 12 ++-- src/cdk/stepper/stepper.ts | 2 +- src/cdk/table/cell.ts | 6 +- src/cdk/table/table.spec.ts | 32 ++++----- src/cdk/testing/tests/test-main-component.ts | 4 +- src/cdk/text-field/autofill.spec.ts | 2 +- src/cdk/text-field/autosize.spec.ts | 2 +- src/cdk/tree/tree.spec.ts | 32 ++++----- src/dev-app/autocomplete/autocomplete-demo.ts | 2 +- src/dev-app/bottom-sheet/bottom-sheet-demo.ts | 2 +- .../connected-overlay-demo.ts | 4 +- src/dev-app/datepicker/datepicker-demo.ts | 2 +- src/dev-app/dialog/dialog-demo.ts | 2 +- src/dev-app/expansion/expansion-demo.ts | 2 +- src/dev-app/google-map/google-map-demo.ts | 2 +- src/dev-app/ripple/ripple-demo.ts | 2 +- src/dev-app/snack-bar/snack-bar-demo.ts | 2 +- src/e2e-app/dialog/dialog-e2e.ts | 2 +- .../focus-monitor-focus-via-example.ts | 2 +- .../focus-monitor-overview-example.ts | 4 +- .../cdk-drag-drop-root-element-example.ts | 2 +- .../cdk-portal-overview-example.ts | 2 +- .../text-field-autofill-monitor-example.ts | 4 +- .../text-field-autosize-textarea-example.ts | 2 +- .../chips-autocomplete-example.ts | 4 +- .../expansion-expand-collapse-all-example.ts | 2 +- .../sidenav-disable-close-example.ts | 2 +- .../table/table-http/table-http-example.ts | 4 +- .../mdc-button/button-base.ts | 2 +- .../mdc-checkbox/checkbox.ts | 6 +- .../mdc-chips/chip-grid.spec.ts | 4 +- .../mdc-chips/chip-input.spec.ts | 2 +- .../mdc-chips/chip-listbox.spec.ts | 4 +- .../mdc-chips/chip-option.spec.ts | 2 +- .../mdc-chips/chip-row.spec.ts | 2 +- .../mdc-chips/chip-row.ts | 2 +- .../mdc-chips/chip.spec.ts | 2 +- src/material-experimental/mdc-chips/chip.ts | 6 +- .../mdc-menu/menu.spec.ts | 68 +++++++++--------- .../mdc-slide-toggle/slide-toggle.ts | 2 +- .../mdc-slider/slider.spec.ts | 6 +- .../mdc-slider/slider.ts | 8 +-- .../mdc-tabs/tab-body.spec.ts | 2 +- .../mdc-tabs/tab-body.ts | 2 +- .../mdc-tabs/tab-group.spec.ts | 4 +- .../mdc-tabs/tab-group.ts | 4 +- .../mdc-tabs/tab-header.ts | 4 +- .../mdc-tabs/tab-nav-bar/tab-nav-bar.spec.ts | 2 +- .../mdc-tabs/tab-nav-bar/tab-nav-bar.ts | 4 +- src/material-experimental/mdc-tabs/tab.ts | 2 +- .../popover-edit/popover-edit.spec.ts | 2 +- .../autocomplete/autocomplete.spec.ts | 22 +++--- src/material/autocomplete/autocomplete.ts | 2 +- src/material/badge/badge.spec.ts | 2 +- .../bottom-sheet/bottom-sheet.spec.ts | 6 +- .../button-toggle/button-toggle.spec.ts | 2 +- src/material/button-toggle/button-toggle.ts | 2 +- src/material/button/button.ts | 2 +- src/material/checkbox/checkbox.spec.ts | 2 +- src/material/checkbox/checkbox.ts | 4 +- src/material/chips/chip-input.spec.ts | 2 +- src/material/chips/chip-list.spec.ts | 8 +-- src/material/chips/chip.spec.ts | 2 +- src/material/chips/chip.ts | 6 +- src/material/core/ripple/ripple.spec.ts | 6 +- src/material/datepicker/calendar.ts | 6 +- src/material/datepicker/datepicker-toggle.ts | 4 +- src/material/datepicker/datepicker.spec.ts | 58 +++++++-------- src/material/datepicker/datepicker.ts | 2 +- src/material/datepicker/month-view.ts | 2 +- .../datepicker/multi-year-view.spec.ts | 2 +- src/material/datepicker/multi-year-view.ts | 2 +- src/material/datepicker/year-view.spec.ts | 2 +- src/material/datepicker/year-view.ts | 2 +- src/material/dialog/dialog.spec.ts | 10 +-- src/material/dialog/testing/shared.spec.ts | 2 +- src/material/expansion/accordion.spec.ts | 6 +- src/material/expansion/expansion-panel.ts | 4 +- src/material/expansion/expansion.spec.ts | 4 +- src/material/form-field/form-field.ts | 12 ++-- src/material/grid-list/grid-list.spec.ts | 2 +- src/material/input/input.spec.ts | 12 ++-- src/material/list/list.ts | 4 +- src/material/list/selection-list.ts | 6 +- src/material/menu/menu.spec.ts | 72 +++++++++---------- src/material/menu/menu.ts | 4 +- src/material/paginator/paginator.spec.ts | 10 +-- src/material/progress-bar/progress-bar.ts | 2 +- .../progress-spinner/progress-spinner.spec.ts | 2 +- src/material/radio/radio.spec.ts | 2 +- src/material/radio/radio.ts | 2 +- .../__name@dasherize__.component.ts.template | 6 +- src/material/select/select.spec.ts | 36 +++++----- src/material/select/select.ts | 8 +-- src/material/sidenav/drawer.spec.ts | 34 ++++----- src/material/sidenav/drawer.ts | 4 +- src/material/sidenav/sidenav.spec.ts | 12 ++-- src/material/sidenav/sidenav.ts | 2 +- src/material/slide-toggle/slide-toggle.ts | 6 +- src/material/slider/slider.spec.ts | 6 +- src/material/slider/slider.ts | 2 +- src/material/snack-bar/snack-bar.spec.ts | 6 +- src/material/snack-bar/testing/shared.spec.ts | 2 +- src/material/sort/sort.spec.ts | 14 ++-- src/material/stepper/stepper.ts | 2 +- src/material/table/table.spec.ts | 4 +- src/material/tabs/tab-body.spec.ts | 2 +- src/material/tabs/tab-body.ts | 2 +- src/material/tabs/tab-group.spec.ts | 4 +- src/material/tabs/tab-group.ts | 4 +- src/material/tabs/tab-header.ts | 4 +- .../tabs/tab-nav-bar/tab-nav-bar.spec.ts | 2 +- src/material/tabs/tab-nav-bar/tab-nav-bar.ts | 4 +- src/material/tabs/tab.ts | 2 +- src/material/tooltip/tooltip.spec.ts | 16 ++--- src/material/tree/tree.spec.ts | 12 ++-- src/youtube-player/youtube-player.spec.ts | 2 +- src/youtube-player/youtube-player.ts | 2 +- tools/tslint-rules/staticQueryRule.ts | 39 ---------- tslint.json | 1 - 132 files changed, 450 insertions(+), 500 deletions(-) delete mode 100644 tools/tslint-rules/staticQueryRule.ts diff --git a/src/a11y-demo/a11y-demo.ts b/src/a11y-demo/a11y-demo.ts index 3cc25e84b78f..8797fc221e2f 100644 --- a/src/a11y-demo/a11y-demo.ts +++ b/src/a11y-demo/a11y-demo.ts @@ -21,8 +21,8 @@ export class AccessibilityDemoRoot implements OnDestroy { private _routerSubscription = Subscription.EMPTY; - @ViewChild('maincontent', {static: false}) mainContent: ElementRef; - @ViewChild('header', {static: false}) sectionHeader: ElementRef; + @ViewChild('maincontent') mainContent: ElementRef; + @ViewChild('header') sectionHeader: ElementRef; navItems = [ {name: 'Home', route: '.'}, diff --git a/src/cdk-experimental/dialog/dialog.spec.ts b/src/cdk-experimental/dialog/dialog.spec.ts index 61b37062e767..573a9ad2e30c 100644 --- a/src/cdk-experimental/dialog/dialog.spec.ts +++ b/src/cdk-experimental/dialog/dialog.spec.ts @@ -1141,9 +1141,7 @@ class ComponentWithOnPushViewContainer { template: ``, }) class ComponentWithChildViewContainer { - @ViewChild(DirectiveWithViewContainer, { - static: false - }) childWithViewContainer: DirectiveWithViewContainer; + @ViewChild(DirectiveWithViewContainer) childWithViewContainer: DirectiveWithViewContainer; get childViewContainer() { return this.childWithViewContainer.viewContainerRef; @@ -1159,7 +1157,7 @@ class ComponentWithTemplateRef { localValue: string; dialogRef: DialogRef; - @ViewChild(TemplateRef, {static: false}) templateRef: TemplateRef; + @ViewChild(TemplateRef) templateRef: TemplateRef; setDialogRef(dialogRef: DialogRef): string { this.dialogRef = dialogRef; diff --git a/src/cdk-experimental/popover-edit/popover-edit.spec.ts b/src/cdk-experimental/popover-edit/popover-edit.spec.ts index 20d1473670ed..b2f0ab06596b 100644 --- a/src/cdk-experimental/popover-edit/popover-edit.spec.ts +++ b/src/cdk-experimental/popover-edit/popover-edit.spec.ts @@ -66,7 +66,7 @@ interface PeriodicElement { selector: 'do-not-use-abstract-cdk-popover-edit-base-test-component' }) abstract class BaseTestComponent { - @ViewChild('table', {static: false}) table: ElementRef; + @ViewChild('table') table: ElementRef; preservedValues = new FormValueContainer(); diff --git a/src/cdk/a11y/aria-describer/aria-describer.spec.ts b/src/cdk/a11y/aria-describer/aria-describer.spec.ts index 8a990254fbe6..1c30fbd80f11 100644 --- a/src/cdk/a11y/aria-describer/aria-describer.spec.ts +++ b/src/cdk/a11y/aria-describer/aria-describer.spec.ts @@ -289,16 +289,16 @@ function expectMessage(el: Element, message: string) { `, }) class TestApp { - @ViewChild('element1', {static: false}) _element1: ElementRef; + @ViewChild('element1') _element1: ElementRef; get element1(): Element { return this._element1.nativeElement; } - @ViewChild('element2', {static: false}) _element2: ElementRef; + @ViewChild('element2') _element2: ElementRef; get element2(): Element { return this._element2.nativeElement; } - @ViewChild('element3', {static: false}) _element3: ElementRef; + @ViewChild('element3') _element3: ElementRef; get element3(): Element { return this._element3.nativeElement; } - @ViewChild('element4', {static: false}) _element4: ElementRef; + @ViewChild('element4') _element4: ElementRef; get element4(): Element { return this._element4.nativeElement; } diff --git a/src/cdk/a11y/focus-trap/focus-trap.spec.ts b/src/cdk/a11y/focus-trap/focus-trap.spec.ts index 076ada54b0bb..fbecb2d847d1 100644 --- a/src/cdk/a11y/focus-trap/focus-trap.spec.ts +++ b/src/cdk/a11y/focus-trap/focus-trap.spec.ts @@ -199,7 +199,7 @@ describe('FocusTrap', () => { ` }) class SimpleFocusTrap { - @ViewChild(CdkTrapFocus, {static: false}) focusTrapDirective: CdkTrapFocus; + @ViewChild(CdkTrapFocus) focusTrapDirective: CdkTrapFocus; } @Component({ @@ -212,7 +212,7 @@ class SimpleFocusTrap { ` }) class FocusTrapWithAutoCapture { - @ViewChild(CdkTrapFocus, {static: false}) focusTrapDirective: CdkTrapFocus; + @ViewChild(CdkTrapFocus) focusTrapDirective: CdkTrapFocus; showTrappedRegion = false; } @@ -226,7 +226,7 @@ class FocusTrapWithAutoCapture { ` }) class FocusTrapWithBindings { - @ViewChild(CdkTrapFocus, {static: false}) focusTrapDirective: CdkTrapFocus; + @ViewChild(CdkTrapFocus) focusTrapDirective: CdkTrapFocus; renderFocusTrap = true; _isFocusTrapEnabled = true; } @@ -246,7 +246,7 @@ class FocusTrapWithBindings { ` }) class FocusTrapTargets { - @ViewChild(CdkTrapFocus, {static: false}) focusTrapDirective: CdkTrapFocus; + @ViewChild(CdkTrapFocus) focusTrapDirective: CdkTrapFocus; } @Component({ @@ -257,7 +257,7 @@ class FocusTrapTargets { ` }) class FocusTrapUnfocusableTarget { - @ViewChild(CdkTrapFocus, {static: false}) focusTrapDirective: CdkTrapFocus; + @ViewChild(CdkTrapFocus) focusTrapDirective: CdkTrapFocus; } @Component({ @@ -270,7 +270,7 @@ class FocusTrapUnfocusableTarget { ` }) class FocusTrapWithSvg { - @ViewChild(CdkTrapFocus, {static: false}) focusTrapDirective: CdkTrapFocus; + @ViewChild(CdkTrapFocus) focusTrapDirective: CdkTrapFocus; } @Component({ @@ -281,5 +281,5 @@ class FocusTrapWithSvg { ` }) class FocusTrapWithoutFocusableElements { - @ViewChild(CdkTrapFocus, {static: false}) focusTrapDirective: CdkTrapFocus; + @ViewChild(CdkTrapFocus) focusTrapDirective: CdkTrapFocus; } diff --git a/src/cdk/bidi/directionality.spec.ts b/src/cdk/bidi/directionality.spec.ts index acf1eb8944e1..b440a03de45d 100644 --- a/src/cdk/bidi/directionality.spec.ts +++ b/src/cdk/bidi/directionality.spec.ts @@ -158,7 +158,7 @@ describe('Directionality', () => { ` }) class ElementWithDir { - @ViewChild(Dir, {static: false}) dir: Dir; + @ViewChild(Dir) dir: Dir; direction = 'rtl'; changeCount = 0; } @@ -167,14 +167,14 @@ class ElementWithDir { template: '
' }) class ElementWithPredefinedAutoDir { - @ViewChild(Dir, {static: false}) dir: Dir; + @ViewChild(Dir) dir: Dir; } @Component({ template: '
' }) class ElementWithPredefinedUppercaseDir { - @ViewChild(Dir, {static: false}) dir: Dir; + @ViewChild(Dir) dir: Dir; } diff --git a/src/cdk/drag-drop/directives/drag.spec.ts b/src/cdk/drag-drop/directives/drag.spec.ts index 31b7a9ceab4c..1c7020d075e1 100644 --- a/src/cdk/drag-drop/directives/drag.spec.ts +++ b/src/cdk/drag-drop/directives/drag.spec.ts @@ -4431,8 +4431,8 @@ describe('CdkDrag', () => { ` }) class StandaloneDraggable { - @ViewChild('dragElement', {static: false}) dragElement: ElementRef; - @ViewChild(CdkDrag, {static: false}) dragInstance: CdkDrag; + @ViewChild('dragElement') dragElement: ElementRef; + @ViewChild(CdkDrag) dragInstance: CdkDrag; startedSpy = jasmine.createSpy('started spy'); endedSpy = jasmine.createSpy('ended spy'); releasedSpy = jasmine.createSpy('released spy'); @@ -4449,8 +4449,8 @@ class StandaloneDraggable { ` }) class StandaloneDraggableWithOnPush { - @ViewChild('dragElement', {static: false}) dragElement: ElementRef; - @ViewChild(CdkDrag, {static: false}) dragInstance: CdkDrag; + @ViewChild('dragElement') dragElement: ElementRef; + @ViewChild(CdkDrag) dragInstance: CdkDrag; } @Component({ @@ -4463,7 +4463,7 @@ class StandaloneDraggableWithOnPush { ` }) class StandaloneDraggableSvg { - @ViewChild('dragElement', {static: false}) dragElement: ElementRef; + @ViewChild('dragElement') dragElement: ElementRef; } @Component({ @@ -4475,10 +4475,10 @@ class StandaloneDraggableSvg { ` }) class StandaloneDraggableWithHandle { - @ViewChild('dragElement', {static: false}) dragElement: ElementRef; - @ViewChild('handleElement', {static: false}) handleElement: ElementRef; - @ViewChild(CdkDrag, {static: false}) dragInstance: CdkDrag; - @ViewChild(CdkDragHandle, {static: false}) handleInstance: CdkDragHandle; + @ViewChild('dragElement') dragElement: ElementRef; + @ViewChild('handleElement') handleElement: ElementRef; + @ViewChild(CdkDrag) dragInstance: CdkDrag; + @ViewChild(CdkDragHandle) handleInstance: CdkDragHandle; } @Component({ @@ -4493,8 +4493,8 @@ class StandaloneDraggableWithHandle { ` }) class StandaloneDraggableWithDelayedHandle { - @ViewChild('dragElement', {static: false}) dragElement: ElementRef; - @ViewChild('handleElement', {static: false}) handleElement: ElementRef; + @ViewChild('dragElement') dragElement: ElementRef; + @ViewChild('handleElement') handleElement: ElementRef; showHandle = false; } @@ -4513,8 +4513,8 @@ class StandaloneDraggableWithDelayedHandle { ` }) class StandaloneDraggableWithIndirectHandle { - @ViewChild('dragElement', {static: false}) dragElement: ElementRef; - @ViewChild('handleElement', {static: false}) handleElement: ElementRef; + @ViewChild('dragElement') dragElement: ElementRef; + @ViewChild('handleElement') handleElement: ElementRef; } @@ -4538,7 +4538,7 @@ class StandaloneDraggableWithIndirectHandle { ` }) class StandaloneDraggableWithMultipleHandles { - @ViewChild('dragElement', {static: false}) dragElement: ElementRef; + @ViewChild('dragElement') dragElement: ElementRef; @ViewChildren(CdkDragHandle) handles: QueryList; } @@ -4566,7 +4566,7 @@ const DROP_ZONE_FIXTURE_TEMPLATE = ` @Component({template: DROP_ZONE_FIXTURE_TEMPLATE}) class DraggableInDropZone { @ViewChildren(CdkDrag) dragItems: QueryList; - @ViewChild(CdkDropList, {static: false}) dropInstance: CdkDropList; + @ViewChild(CdkDropList) dropInstance: CdkDropList; items = [ {value: 'Zero', height: ITEM_HEIGHT, margin: 0}, {value: 'One', height: ITEM_HEIGHT, margin: 0}, @@ -4676,7 +4676,7 @@ const HORIZONTAL_FIXTURE_TEMPLATE = ` }) class DraggableInHorizontalDropZone { @ViewChildren(CdkDrag) dragItems: QueryList; - @ViewChild(CdkDropList, {static: false}) dropInstance: CdkDropList; + @ViewChild(CdkDropList) dropInstance: CdkDropList; items = [ {value: 'Zero', width: ITEM_WIDTH, margin: 0}, {value: 'One', width: ITEM_WIDTH, margin: 0}, @@ -4736,7 +4736,7 @@ class DraggableInScrollableHorizontalDropZone extends DraggableInHorizontalDropZ ` }) class DraggableInDropZoneWithCustomPreview { - @ViewChild(CdkDropList, {static: false}) dropInstance: CdkDropList; + @ViewChild(CdkDropList) dropInstance: CdkDropList; @ViewChildren(CdkDrag) dragItems: QueryList; items = ['Zero', 'One', 'Two', 'Three']; boundarySelector: string; @@ -4762,7 +4762,7 @@ class DraggableInDropZoneWithCustomPreview { ` }) class DraggableInDropZoneWithCustomTextOnlyPreview { - @ViewChild(CdkDropList, {static: false}) dropInstance: CdkDropList; + @ViewChild(CdkDropList) dropInstance: CdkDropList; @ViewChildren(CdkDrag) dragItems: QueryList; items = ['Zero', 'One', 'Two', 'Three']; } @@ -4956,9 +4956,9 @@ class ConnectedDropZonesViaGroupDirective extends ConnectedDropZones { ` }) class DraggableWithAlternateRoot { - @ViewChild('dragElement', {static: false}) dragElement: ElementRef; - @ViewChild('dragRoot', {static: false}) dragRoot: ElementRef; - @ViewChild(CdkDrag, {static: false}) dragInstance: CdkDrag; + @ViewChild('dragElement') dragElement: ElementRef; + @ViewChild('dragRoot') dragRoot: ElementRef; + @ViewChild(CdkDrag) dragInstance: CdkDrag; rootElementSelector: string; } @@ -5017,9 +5017,9 @@ class ConnectedDropZonesWithSingleItems { ` }) class NestedDropListGroups { - @ViewChild('group', {static: false}) group: CdkDropListGroup; - @ViewChild('listOne', {static: false}) listOne: CdkDropList; - @ViewChild('listTwo', {static: false}) listTwo: CdkDropList; + @ViewChild('group') group: CdkDropListGroup; + @ViewChild('listOne') listOne: CdkDropList; + @ViewChild('listTwo') listTwo: CdkDropList; } @@ -5044,7 +5044,7 @@ class DraggableOnNgContainer {} }) class DraggableInDropZoneWithoutEvents { @ViewChildren(CdkDrag) dragItems: QueryList; - @ViewChild(CdkDropList, {static: false}) dropInstance: CdkDropList; + @ViewChild(CdkDropList) dropInstance: CdkDropList; items = [ {value: 'Zero', height: ITEM_HEIGHT}, {value: 'One', height: ITEM_HEIGHT}, @@ -5184,8 +5184,8 @@ class WrappedDropContainerComponent { ` }) class NestedDragsComponent { - @ViewChild('container', {static: false}) container: ElementRef; - @ViewChild('item', {static: false}) item: ElementRef; + @ViewChild('container') container: ElementRef; + @ViewChild('item') item: ElementRef; containerDragStartedSpy = jasmine.createSpy('container drag started spy'); containerDragMovedSpy = jasmine.createSpy('container drag moved spy'); @@ -5215,8 +5215,8 @@ class NestedDragsComponent { }) class NestedDropZones { @ViewChildren(CdkDrag) dragItems: QueryList; - @ViewChild('outerList', {static: false}) outerList: ElementRef; - @ViewChild('innerList', {static: false}) innerList: ElementRef; + @ViewChild('outerList') outerList: ElementRef; + @ViewChild('innerList') innerList: ElementRef; items = ['Zero', 'One', 'Two', 'Three']; } diff --git a/src/cdk/drag-drop/directives/drag.ts b/src/cdk/drag-drop/directives/drag.ts index 4a97ee28b93e..f63767f82048 100644 --- a/src/cdk/drag-drop/directives/drag.ts +++ b/src/cdk/drag-drop/directives/drag.ts @@ -88,10 +88,10 @@ export class CdkDrag implements AfterViewInit, OnChanges, OnDestroy { @ContentChildren(CdkDragHandle, {descendants: true}) _handles: QueryList; /** Element that will be used as a template to create the draggable item's preview. */ - @ContentChild(CdkDragPreview, {static: false}) _previewTemplate: CdkDragPreview; + @ContentChild(CdkDragPreview) _previewTemplate: CdkDragPreview; /** Template for placeholder element rendered to show where a draggable would be dropped. */ - @ContentChild(CdkDragPlaceholder, {static: false}) _placeholderTemplate: CdkDragPlaceholder; + @ContentChild(CdkDragPlaceholder) _placeholderTemplate: CdkDragPlaceholder; /** Arbitrary data to attach to this drag instance. */ @Input('cdkDragData') data: T; diff --git a/src/cdk/observers/observe-content.spec.ts b/src/cdk/observers/observe-content.spec.ts index e6d015b245cc..ba9137f1cb76 100644 --- a/src/cdk/observers/observe-content.spec.ts +++ b/src/cdk/observers/observe-content.spec.ts @@ -228,6 +228,6 @@ class ComponentWithDebouncedListener { template: `
{{text}}
` }) class UnobservedComponentWithTextContent { - @ViewChild('contentEl', {static: false}) contentEl: ElementRef; + @ViewChild('contentEl') contentEl: ElementRef; text = ''; } diff --git a/src/cdk/overlay/overlay-directives.spec.ts b/src/cdk/overlay/overlay-directives.spec.ts index 48c58c598ee1..776c73fe6303 100644 --- a/src/cdk/overlay/overlay-directives.spec.ts +++ b/src/cdk/overlay/overlay-directives.spec.ts @@ -574,9 +574,9 @@ describe('Overlay directives', () => { `, }) class ConnectedOverlayDirectiveTest { - @ViewChild(CdkConnectedOverlay, {static: false}) connectedOverlayDirective: CdkConnectedOverlay; - @ViewChild('trigger', {static: false}) trigger: CdkOverlayOrigin; - @ViewChild('otherTrigger', {static: false}) otherTrigger: CdkOverlayOrigin; + @ViewChild(CdkConnectedOverlay) connectedOverlayDirective: CdkConnectedOverlay; + @ViewChild('trigger') trigger: CdkOverlayOrigin; + @ViewChild('otherTrigger') otherTrigger: CdkOverlayOrigin; isOpen = false; width: number | string; @@ -609,6 +609,6 @@ class ConnectedOverlayDirectiveTest { Menu content`, }) class ConnectedOverlayPropertyInitOrder { - @ViewChild(CdkConnectedOverlay, {static: false}) connectedOverlayDirective: CdkConnectedOverlay; - @ViewChild('trigger', {static: false}) trigger: CdkOverlayOrigin; + @ViewChild(CdkConnectedOverlay) connectedOverlayDirective: CdkConnectedOverlay; + @ViewChild('trigger') trigger: CdkOverlayOrigin; } diff --git a/src/cdk/overlay/overlay.spec.ts b/src/cdk/overlay/overlay.spec.ts index 336a05db0543..7e9e3598fa99 100644 --- a/src/cdk/overlay/overlay.spec.ts +++ b/src/cdk/overlay/overlay.spec.ts @@ -980,7 +980,7 @@ class PizzaMsg { } /** Test-bed component that contains a TempatePortal and an ElementRef. */ @Component({template: `Cake`}) class TestComponentWithTemplatePortals { - @ViewChild(CdkPortal, {static: false}) templatePortal: CdkPortal; + @ViewChild(CdkPortal) templatePortal: CdkPortal; constructor(public viewContainerRef: ViewContainerRef) { } } diff --git a/src/cdk/scrolling/scroll-dispatcher.spec.ts b/src/cdk/scrolling/scroll-dispatcher.spec.ts index fe7be9ce9f98..e43d7821bef3 100644 --- a/src/cdk/scrolling/scroll-dispatcher.spec.ts +++ b/src/cdk/scrolling/scroll-dispatcher.spec.ts @@ -244,8 +244,8 @@ describe('ScrollDispatcher', () => { template: `
` }) class ScrollingComponent { - @ViewChild(CdkScrollable, {static: false}) scrollable: CdkScrollable; - @ViewChild('scrollingElement', {static: false}) scrollingElement: ElementRef; + @ViewChild(CdkScrollable) scrollable: CdkScrollable; + @ViewChild('scrollingElement') scrollingElement: ElementRef; } @@ -262,7 +262,7 @@ class ScrollingComponent { ` }) class NestedScrollingComponent { - @ViewChild('interestingElement', {static: false}) interestingElement: ElementRef; + @ViewChild('interestingElement') interestingElement: ElementRef; } const TEST_COMPONENTS = [ScrollingComponent, NestedScrollingComponent]; diff --git a/src/cdk/scrolling/scrollable.spec.ts b/src/cdk/scrolling/scrollable.spec.ts index 2199e2db0bb9..6839f24dc83f 100644 --- a/src/cdk/scrolling/scrollable.spec.ts +++ b/src/cdk/scrolling/scrollable.spec.ts @@ -241,10 +241,10 @@ describe('CdkScrollable', () => { }) class ScrollableViewport { @Input() dir: Direction; - @ViewChild(CdkScrollable, {static: false}) scrollable: CdkScrollable; - @ViewChild('scrollContainer', {static: false}) scrollContainer: ElementRef; - @ViewChild('firstRowStart', {static: false}) firstRowStart: ElementRef; - @ViewChild('firstRowEnd', {static: false}) firstRowEnd: ElementRef; - @ViewChild('lastRowStart', {static: false}) lastRowStart: ElementRef; - @ViewChild('lastRowEnd', {static: false}) lastRowEnd: ElementRef; + @ViewChild(CdkScrollable) scrollable: CdkScrollable; + @ViewChild('scrollContainer') scrollContainer: ElementRef; + @ViewChild('firstRowStart') firstRowStart: ElementRef; + @ViewChild('firstRowEnd') firstRowEnd: ElementRef; + @ViewChild('lastRowStart') lastRowStart: ElementRef; + @ViewChild('lastRowEnd') lastRowEnd: ElementRef; } diff --git a/src/cdk/stepper/stepper.ts b/src/cdk/stepper/stepper.ts index f43d8e81a82c..5c5b860a5e3b 100644 --- a/src/cdk/stepper/stepper.ts +++ b/src/cdk/stepper/stepper.ts @@ -118,7 +118,7 @@ export class CdkStep implements OnChanges { _displayDefaultIndicatorType: boolean; /** Template for step label if it exists. */ - @ContentChild(CdkStepLabel, {static: false}) stepLabel: CdkStepLabel; + @ContentChild(CdkStepLabel) stepLabel: CdkStepLabel; /** Template for step content. */ @ViewChild(TemplateRef, {static: true}) content: TemplateRef; diff --git a/src/cdk/table/cell.ts b/src/cdk/table/cell.ts index 63c0cd07eedd..73b78f5eb281 100644 --- a/src/cdk/table/cell.ts +++ b/src/cdk/table/cell.ts @@ -93,13 +93,13 @@ export class CdkColumnDef extends _CdkColumnDefBase implements CanStick { _stickyEnd: boolean = false; /** @docs-private */ - @ContentChild(CdkCellDef, {static: false}) cell: CdkCellDef; + @ContentChild(CdkCellDef) cell: CdkCellDef; /** @docs-private */ - @ContentChild(CdkHeaderCellDef, {static: false}) headerCell: CdkHeaderCellDef; + @ContentChild(CdkHeaderCellDef) headerCell: CdkHeaderCellDef; /** @docs-private */ - @ContentChild(CdkFooterCellDef, {static: false}) footerCell: CdkFooterCellDef; + @ContentChild(CdkFooterCellDef) footerCell: CdkFooterCellDef; /** * Transformed version of the column name that can be used as part of a CSS classname. Excludes diff --git a/src/cdk/table/table.spec.ts b/src/cdk/table/table.spec.ts index 94a012f9dd65..c05ce6c32b00 100644 --- a/src/cdk/table/table.spec.ts +++ b/src/cdk/table/table.spec.ts @@ -1462,7 +1462,7 @@ class SimpleCdkTableApp { dataSource: FakeDataSource | undefined = new FakeDataSource(); columnsToRender = ['column_a', 'column_b', 'column_c']; - @ViewChild(CdkTable, {static: false}) table: CdkTable; + @ViewChild(CdkTable) table: CdkTable; } @Component({ @@ -1492,7 +1492,7 @@ class CdkTableWithDifferentDataInputsApp { dataSource: DataSource | Observable | TestData[] | any = null; columnsToRender = ['column_a', 'column_b', 'column_c']; - @ViewChild(CdkTable, {static: false}) table: CdkTable; + @ViewChild(CdkTable) table: CdkTable; } @Component({ @@ -1623,7 +1623,7 @@ class WhenRowCdkTableApp { this.dataSource.addData(); } - @ViewChild(CdkTable, {static: false}) table: CdkTable; + @ViewChild(CdkTable) table: CdkTable; showIndexColumns() { const indexColumns = ['index', 'dataIndex', 'renderIndex']; @@ -1726,7 +1726,7 @@ class WhenRowWithoutDefaultCdkTableApp { isIndex1 = (index: number, _rowData: TestData) => index == 1; hasC3 = (_index: number, rowData: TestData) => rowData.c == 'c_3'; - @ViewChild(CdkTable, {static: false}) table: CdkTable; + @ViewChild(CdkTable) table: CdkTable; } @Component({ @@ -1769,7 +1769,7 @@ class WhenRowMultipleDefaultsCdkTableApp { columnsToRender = ['column_a', 'column_b', 'column_c']; hasC3 = (_index: number, rowData: TestData) => rowData.c == 'c_3'; - @ViewChild(CdkTable, {static: false}) table: CdkTable; + @ViewChild(CdkTable) table: CdkTable; } @Component({ @@ -1789,7 +1789,7 @@ class DynamicDataSourceCdkTableApp { dataSource: FakeDataSource | undefined; columnsToRender = ['column_a']; - @ViewChild(CdkTable, {static: false}) table: CdkTable; + @ViewChild(CdkTable) table: CdkTable; } @Component({ @@ -1816,7 +1816,7 @@ class TrackByCdkTableApp { dataSource: FakeDataSource = new FakeDataSource(); columnsToRender = ['column_a', 'column_b']; - @ViewChild(CdkTable, {static: false}) table: CdkTable; + @ViewChild(CdkTable) table: CdkTable; trackBy = (index: number, item: TestData) => { switch (this.trackByStrategy) { @@ -1866,7 +1866,7 @@ class StickyFlexLayoutCdkTableApp { dataSource: FakeDataSource = new FakeDataSource(); columns = ['column-1', 'column-2', 'column-3', 'column-4', 'column-5', 'column-6']; - @ViewChild(CdkTable, {static: false}) table: CdkTable; + @ViewChild(CdkTable) table: CdkTable; dir = 'ltr'; stickyHeaders: string[] = []; @@ -1919,7 +1919,7 @@ class StickyNativeLayoutCdkTableApp { dataSource: FakeDataSource = new FakeDataSource(); columns = ['column-1', 'column-2', 'column-3', 'column-4', 'column-5', 'column-6']; - @ViewChild(CdkTable, {static: false}) table: CdkTable; + @ViewChild(CdkTable) table: CdkTable; stickyHeaders: string[] = []; stickyFooters: string[] = []; @@ -1948,7 +1948,7 @@ class DynamicColumnDefinitionsCdkTableApp { dynamicColumns: any[] = []; dataSource: FakeDataSource = new FakeDataSource(); - @ViewChild(CdkTable, {static: false}) table: CdkTable; + @ViewChild(CdkTable) table: CdkTable; } @Component({ @@ -1968,7 +1968,7 @@ class CustomRoleCdkTableApp { dataSource: FakeDataSource = new FakeDataSource(); columnsToRender = ['column_a']; - @ViewChild(CdkTable, {static: false}) table: CdkTable; + @ViewChild(CdkTable) table: CdkTable; } @Component({ @@ -1988,7 +1988,7 @@ class CrazyColumnNameCdkTableApp { dataSource: FakeDataSource = new FakeDataSource(); columnsToRender = ['crazy-column-NAME-1!@#$%^-_&*()2']; - @ViewChild(CdkTable, {static: false}) table: CdkTable; + @ViewChild(CdkTable) table: CdkTable; } @Component({ @@ -2195,7 +2195,7 @@ class RowContextCdkTableApp { }) class WrapperCdkTableApp implements AfterContentInit { @ContentChildren(CdkColumnDef) columnDefs: QueryList; - @ContentChild(CdkHeaderRowDef, {static: false}) headerRowDef: CdkHeaderRowDef; + @ContentChild(CdkHeaderRowDef) headerRowDef: CdkHeaderRowDef; @ContentChildren(CdkRowDef) rowDefs: QueryList>; @ViewChild(CdkTable, {static: true}) table: CdkTable; @@ -2269,7 +2269,7 @@ class NativeHtmlTableApp { dataSource: FakeDataSource | undefined = new FakeDataSource(); columnsToRender = ['column_a', 'column_b', 'column_c']; - @ViewChild(CdkTable, {static: false}) table: CdkTable; + @ViewChild(CdkTable) table: CdkTable; } @Component({ @@ -2298,7 +2298,7 @@ class NativeTableWithNoHeaderOrFooterRows { dataSource: FakeDataSource | undefined = new FakeDataSource(); columnsToRender = ['column_a', 'column_b', 'column_c']; - @ViewChild(CdkTable, {static: false}) table: CdkTable; + @ViewChild(CdkTable) table: CdkTable; } @Component({ @@ -2319,7 +2319,7 @@ class NativeHtmlTableWithCaptionApp { dataSource: FakeDataSource | undefined = new FakeDataSource(); columnsToRender = ['column_a']; - @ViewChild(CdkTable, {static: false}) table: CdkTable; + @ViewChild(CdkTable) table: CdkTable; } function getElements(element: Element, query: string): Element[] { diff --git a/src/cdk/testing/tests/test-main-component.ts b/src/cdk/testing/tests/test-main-component.ts index bb3ac48613d1..7a905346c2b9 100644 --- a/src/cdk/testing/tests/test-main-component.ts +++ b/src/cdk/testing/tests/test-main-component.ts @@ -44,8 +44,8 @@ export class TestMainComponent implements OnDestroy { relativeX = 0; relativeY = 0; - @ViewChild('clickTestElement', {static: false}) clickTestElement: ElementRef; - @ViewChild('taskStateResult', {static: false}) taskStateResultElement: ElementRef; + @ViewChild('clickTestElement') clickTestElement: ElementRef; + @ViewChild('taskStateResult') taskStateResultElement: ElementRef; private _fakeOverlayElement: HTMLElement; diff --git a/src/cdk/text-field/autofill.spec.ts b/src/cdk/text-field/autofill.spec.ts index 053eb809bd0a..cd3da5c3ac27 100644 --- a/src/cdk/text-field/autofill.spec.ts +++ b/src/cdk/text-field/autofill.spec.ts @@ -227,5 +227,5 @@ class Inputs { }) class InputWithCdkAutofilled { // Cast to `any` so we can stub out some methods in the tests. - @ViewChild('input', {static: false}) input: ElementRef; + @ViewChild('input') input: ElementRef; } diff --git a/src/cdk/text-field/autosize.spec.ts b/src/cdk/text-field/autosize.spec.ts index f5d9b34a772b..c6f125c33bff 100644 --- a/src/cdk/text-field/autosize.spec.ts +++ b/src/cdk/text-field/autosize.spec.ts @@ -295,7 +295,7 @@ const textareaStyleReset = ` styles: [textareaStyleReset], }) class AutosizeTextAreaWithContent { - @ViewChild('autosize', {static: false}) autosize: CdkTextareaAutosize; + @ViewChild('autosize') autosize: CdkTextareaAutosize; minRows: number | null = null; maxRows: number | null = null; content: string = ''; diff --git a/src/cdk/tree/tree.spec.ts b/src/cdk/tree/tree.spec.ts index 66ed8b85118f..4aaf2c6b487a 100644 --- a/src/cdk/tree/tree.spec.ts +++ b/src/cdk/tree/tree.spec.ts @@ -1154,7 +1154,7 @@ class SimpleCdkTreeApp { dataSource: FakeDataSource | null = new FakeDataSource(this.treeControl); indent: number | string = 28; - @ViewChild(CdkTree, {static: false}) tree: CdkTree; + @ViewChild(CdkTree) tree: CdkTree; @ViewChildren(CdkTreeNodePadding) paddingNodes: QueryList>; } @@ -1175,7 +1175,7 @@ class NestedCdkTreeApp { dataSource: FakeDataSource | null = new FakeDataSource(this.treeControl); - @ViewChild(CdkTree, {static: false}) tree: CdkTree; + @ViewChild(CdkTree) tree: CdkTree; } @Component({ @@ -1195,7 +1195,7 @@ class StaticNestedCdkTreeApp { dataSource: FakeDataSource; - @ViewChild(CdkTree, {static: false}) tree: CdkTree; + @ViewChild(CdkTree) tree: CdkTree; constructor() { const dataSource = new FakeDataSource(this.treeControl); @@ -1231,7 +1231,7 @@ class WhenNodeNestedCdkTreeApp { dataSource: FakeDataSource | null = new FakeDataSource(this.treeControl); - @ViewChild(CdkTree, {static: false}) tree: CdkTree; + @ViewChild(CdkTree) tree: CdkTree; } @@ -1255,7 +1255,7 @@ class CdkTreeAppWithToggle { treeControl: TreeControl = new FlatTreeControl(this.getLevel, this.isExpandable); dataSource: FakeDataSource | null = new FakeDataSource(this.treeControl); - @ViewChild(CdkTree, {static: false}) tree: CdkTree; + @ViewChild(CdkTree) tree: CdkTree; } @Component({ @@ -1279,7 +1279,7 @@ class NestedCdkTreeAppWithToggle { treeControl: TreeControl = new NestedTreeControl(this.getChildren); dataSource: FakeDataSource | null = new FakeDataSource(this.treeControl); - @ViewChild(CdkTree, {static: false}) tree: CdkTree; + @ViewChild(CdkTree) tree: CdkTree; } @Component({ @@ -1307,7 +1307,7 @@ class WhenNodeCdkTreeApp { dataSource: FakeDataSource | null = new FakeDataSource(this.treeControl); - @ViewChild(CdkTree, {static: false}) tree: CdkTree; + @ViewChild(CdkTree) tree: CdkTree; } @Component({ @@ -1333,7 +1333,7 @@ class ArrayDataSourceCdkTreeApp { return this.dataSource.data; } - @ViewChild(CdkTree, {static: false}) tree: CdkTree; + @ViewChild(CdkTree) tree: CdkTree; } @Component({ @@ -1359,7 +1359,7 @@ class ObservableDataSourceCdkTreeApp { return this.dataSource._dataChange; } - @ViewChild(CdkTree, {static: false}) tree: CdkTree; + @ViewChild(CdkTree) tree: CdkTree; } @Component({ @@ -1384,7 +1384,7 @@ class ArrayDataSourceNestedCdkTreeApp { return this.dataSource.data; } - @ViewChild(CdkTree, {static: false}) tree: CdkTree; + @ViewChild(CdkTree) tree: CdkTree; } @Component({ @@ -1409,7 +1409,7 @@ class ObservableDataSourceNestedCdkTreeApp { return this.dataSource._dataChange; } - @ViewChild(CdkTree, {static: false}) tree: CdkTree; + @ViewChild(CdkTree) tree: CdkTree; } @Component({ @@ -1431,7 +1431,7 @@ class NestedCdkErrorTreeApp { dataSource: FakeDataSource | null = new FakeDataSource(this.treeControl); - @ViewChild(CdkTree, {static: false}) tree: CdkTree; + @ViewChild(CdkTree) tree: CdkTree; } class FakeTreeControl extends BaseTreeControl { @@ -1463,7 +1463,7 @@ class FlatCdkErrorTreeApp { dataSource: FakeDataSource | null = new FakeDataSource(this.treeControl); - @ViewChild(CdkTree, {static: false}) tree: CdkTree; + @ViewChild(CdkTree) tree: CdkTree; } @@ -1490,7 +1490,7 @@ class DepthNestedCdkTreeApp { return this.dataSource.data; } - @ViewChild(CdkTree, {static: false}) tree: CdkTree; + @ViewChild(CdkTree) tree: CdkTree; } @Component({ @@ -1519,7 +1519,7 @@ class CdkTreeAppWithTrackBy { treeControl: TreeControl = new FlatTreeControl(this.getLevel, this.isExpandable); dataSource: FakeDataSource = new FakeDataSource(this.treeControl); - @ViewChild(CdkTree, {static: false}) tree: CdkTree; + @ViewChild(CdkTree) tree: CdkTree; } @Component({ @@ -1553,5 +1553,5 @@ class NestedCdkTreeAppWithTrackBy { return this.dataSource.data; } - @ViewChild(CdkTree, {static: false}) tree: CdkTree; + @ViewChild(CdkTree) tree: CdkTree; } diff --git a/src/dev-app/autocomplete/autocomplete-demo.ts b/src/dev-app/autocomplete/autocomplete-demo.ts index 25884ffe2f2f..105baa586b0d 100644 --- a/src/dev-app/autocomplete/autocomplete-demo.ts +++ b/src/dev-app/autocomplete/autocomplete-demo.ts @@ -39,7 +39,7 @@ export class AutocompleteDemo { tdDisabled = false; - @ViewChild(NgModel, {static: false}) modelDir: NgModel; + @ViewChild(NgModel) modelDir: NgModel; groupedStates: StateGroup[]; filteredGroupedStates: StateGroup[]; diff --git a/src/dev-app/bottom-sheet/bottom-sheet-demo.ts b/src/dev-app/bottom-sheet/bottom-sheet-demo.ts index f5558aba33b1..44afc8b93fa3 100644 --- a/src/dev-app/bottom-sheet/bottom-sheet-demo.ts +++ b/src/dev-app/bottom-sheet/bottom-sheet-demo.ts @@ -30,7 +30,7 @@ export class BottomSheetDemo { direction: 'ltr' }; - @ViewChild(TemplateRef, {static: false}) template: TemplateRef; + @ViewChild(TemplateRef) template: TemplateRef; constructor(private _bottomSheet: MatBottomSheet) {} diff --git a/src/dev-app/connected-overlay/connected-overlay-demo.ts b/src/dev-app/connected-overlay/connected-overlay-demo.ts index 3a57b8abfe12..13cf6ef1d443 100644 --- a/src/dev-app/connected-overlay/connected-overlay-demo.ts +++ b/src/dev-app/connected-overlay/connected-overlay-demo.ts @@ -32,8 +32,8 @@ import { encapsulation: ViewEncapsulation.None }) export class ConnectedOverlayDemo { - @ViewChild(CdkOverlayOrigin, {static: false}) _overlayOrigin: CdkOverlayOrigin; - @ViewChild('overlay', {static: false}) overlayTemplate: TemplateRef; + @ViewChild(CdkOverlayOrigin) _overlayOrigin: CdkOverlayOrigin; + @ViewChild('overlay') overlayTemplate: TemplateRef; originX: HorizontalConnectionPos = 'start'; originY: VerticalConnectionPos = 'bottom'; diff --git a/src/dev-app/datepicker/datepicker-demo.ts b/src/dev-app/datepicker/datepicker-demo.ts index d8a60193a224..110c1ce1c439 100644 --- a/src/dev-app/datepicker/datepicker-demo.ts +++ b/src/dev-app/datepicker/datepicker-demo.ts @@ -119,7 +119,7 @@ export class CustomHeader implements OnDestroy { }) export class CustomHeaderNgContent { - @ViewChild(MatCalendarHeader, {static: false}) + @ViewChild(MatCalendarHeader) header: MatCalendarHeader; constructor(@Optional() private _dateAdapter: DateAdapter) {} diff --git a/src/dev-app/dialog/dialog-demo.ts b/src/dev-app/dialog/dialog-demo.ts index 017c34cb957c..9016bd6cc911 100644 --- a/src/dev-app/dialog/dialog-demo.ts +++ b/src/dev-app/dialog/dialog-demo.ts @@ -47,7 +47,7 @@ export class DialogDemo { }; numTemplateOpens = 0; - @ViewChild(TemplateRef, {static: false}) template: TemplateRef; + @ViewChild(TemplateRef) template: TemplateRef; constructor(public dialog: MatDialog, @Inject(DOCUMENT) doc: any) { // Possible useful example for the open and closeAll events. diff --git a/src/dev-app/expansion/expansion-demo.ts b/src/dev-app/expansion/expansion-demo.ts index 3622645a2896..6a109b01c55c 100644 --- a/src/dev-app/expansion/expansion-demo.ts +++ b/src/dev-app/expansion/expansion-demo.ts @@ -19,7 +19,7 @@ import { templateUrl: 'expansion-demo.html', }) export class ExpansionDemo { - @ViewChild(MatAccordion, {static: false}) accordion: MatAccordion; + @ViewChild(MatAccordion) accordion: MatAccordion; displayMode: MatAccordionDisplayMode = 'default'; multi = false; diff --git a/src/dev-app/google-map/google-map-demo.ts b/src/dev-app/google-map/google-map-demo.ts index ca8cbc7a0902..7200f096921a 100644 --- a/src/dev-app/google-map/google-map-demo.ts +++ b/src/dev-app/google-map/google-map-demo.ts @@ -16,7 +16,7 @@ import {MapInfoWindow, MapMarker} from '@angular/google-maps'; templateUrl: 'google-map-demo.html', }) export class GoogleMapDemo { - @ViewChild(MapInfoWindow, {static: false}) infoWindow: MapInfoWindow; + @ViewChild(MapInfoWindow) infoWindow: MapInfoWindow; center = {lat: 24, lng: 12}; markerOptions = {draggable: false}; diff --git a/src/dev-app/ripple/ripple-demo.ts b/src/dev-app/ripple/ripple-demo.ts index ffb429ce2e42..38c5cfccc0c0 100644 --- a/src/dev-app/ripple/ripple-demo.ts +++ b/src/dev-app/ripple/ripple-demo.ts @@ -17,7 +17,7 @@ import {MatRipple} from '@angular/material/core'; styleUrls: ['ripple-demo.css'], }) export class RippleDemo { - @ViewChild(MatRipple, {static: false}) ripple: MatRipple; + @ViewChild(MatRipple) ripple: MatRipple; centered = false; disabled = false; diff --git a/src/dev-app/snack-bar/snack-bar-demo.ts b/src/dev-app/snack-bar/snack-bar-demo.ts index b5de44a9c7a0..231c187b4d74 100644 --- a/src/dev-app/snack-bar/snack-bar-demo.ts +++ b/src/dev-app/snack-bar/snack-bar-demo.ts @@ -23,7 +23,7 @@ import { templateUrl: 'snack-bar-demo.html', }) export class SnackBarDemo { - @ViewChild('template', {static: false}) template: TemplateRef; + @ViewChild('template') template: TemplateRef; message = 'Snack Bar opened.'; actionButtonLabel = 'Retry'; action = false; diff --git a/src/e2e-app/dialog/dialog-e2e.ts b/src/e2e-app/dialog/dialog-e2e.ts index 11a016e55819..97b07dfaf395 100644 --- a/src/e2e-app/dialog/dialog-e2e.ts +++ b/src/e2e-app/dialog/dialog-e2e.ts @@ -9,7 +9,7 @@ import {MatDialog, MatDialogRef, MatDialogConfig} from '@angular/material/dialog export class DialogE2E { dialogRef: MatDialogRef | null; - @ViewChild(TemplateRef, {static: false}) templateRef: TemplateRef; + @ViewChild(TemplateRef) templateRef: TemplateRef; constructor (private _dialog: MatDialog) { } diff --git a/src/material-examples/cdk/a11y/focus-monitor-focus-via/focus-monitor-focus-via-example.ts b/src/material-examples/cdk/a11y/focus-monitor-focus-via/focus-monitor-focus-via-example.ts index 65a01eb8e3e5..e5c38a07c4f4 100644 --- a/src/material-examples/cdk/a11y/focus-monitor-focus-via/focus-monitor-focus-via-example.ts +++ b/src/material-examples/cdk/a11y/focus-monitor-focus-via/focus-monitor-focus-via-example.ts @@ -16,7 +16,7 @@ import { styleUrls: ['focus-monitor-focus-via-example.css'] }) export class FocusMonitorFocusViaExample implements OnDestroy, AfterViewInit { - @ViewChild('monitored', {static: false}) monitoredEl: ElementRef; + @ViewChild('monitored') monitoredEl: ElementRef; origin = this.formatOrigin(null); diff --git a/src/material-examples/cdk/a11y/focus-monitor-overview/focus-monitor-overview-example.ts b/src/material-examples/cdk/a11y/focus-monitor-overview/focus-monitor-overview-example.ts index 3290c5076d0f..073854c5b29e 100644 --- a/src/material-examples/cdk/a11y/focus-monitor-overview/focus-monitor-overview-example.ts +++ b/src/material-examples/cdk/a11y/focus-monitor-overview/focus-monitor-overview-example.ts @@ -16,8 +16,8 @@ import { styleUrls: ['focus-monitor-overview-example.css'] }) export class FocusMonitorOverviewExample implements OnDestroy, AfterViewInit { - @ViewChild('element', {static: false}) element: ElementRef; - @ViewChild('subtree', {static: false}) subtree: ElementRef; + @ViewChild('element') element: ElementRef; + @ViewChild('subtree') subtree: ElementRef; elementOrigin = this.formatOrigin(null); subtreeOrigin = this.formatOrigin(null); diff --git a/src/material-examples/cdk/drag-drop/cdk-drag-drop-root-element/cdk-drag-drop-root-element-example.ts b/src/material-examples/cdk/drag-drop/cdk-drag-drop-root-element/cdk-drag-drop-root-element-example.ts index 629069287a1a..b9be4c475961 100644 --- a/src/material-examples/cdk/drag-drop/cdk-drag-drop-root-element/cdk-drag-drop-root-element-example.ts +++ b/src/material-examples/cdk/drag-drop/cdk-drag-drop-root-element/cdk-drag-drop-root-element-example.ts @@ -18,7 +18,7 @@ import {TemplatePortal} from '@angular/cdk/portal'; styleUrls: ['cdk-drag-drop-root-element-example.css'], }) export class CdkDragDropRootElementExample implements AfterViewInit, OnDestroy { - @ViewChild(TemplateRef, {static: false}) _dialogTemplate: TemplateRef; + @ViewChild(TemplateRef) _dialogTemplate: TemplateRef; private _overlayRef: OverlayRef; private _portal: TemplatePortal; diff --git a/src/material-examples/cdk/portal/cdk-portal-overview/cdk-portal-overview-example.ts b/src/material-examples/cdk/portal/cdk-portal-overview/cdk-portal-overview-example.ts index d5a71d1a25ab..f4acdbc2f519 100644 --- a/src/material-examples/cdk/portal/cdk-portal-overview/cdk-portal-overview-example.ts +++ b/src/material-examples/cdk/portal/cdk-portal-overview/cdk-portal-overview-example.ts @@ -10,7 +10,7 @@ import {ComponentPortal, Portal, TemplatePortal} from '@angular/cdk/portal'; styleUrls: ['cdk-portal-overview-example.css'], }) export class CdkPortalOverviewExample implements AfterViewInit { - @ViewChild('templatePortalContent', {static: false}) templatePortalContent: TemplateRef; + @ViewChild('templatePortalContent') templatePortalContent: TemplateRef; selectedPortal: Portal; componentPortal: ComponentPortal; templatePortal: TemplatePortal; diff --git a/src/material-examples/cdk/text-field/text-field-autofill-monitor/text-field-autofill-monitor-example.ts b/src/material-examples/cdk/text-field/text-field-autofill-monitor/text-field-autofill-monitor-example.ts index 6d8f5713822a..409632c74e2c 100644 --- a/src/material-examples/cdk/text-field/text-field-autofill-monitor/text-field-autofill-monitor-example.ts +++ b/src/material-examples/cdk/text-field/text-field-autofill-monitor/text-field-autofill-monitor-example.ts @@ -8,8 +8,8 @@ import {AfterViewInit, Component, ElementRef, OnDestroy, ViewChild} from '@angul styleUrls: ['./text-field-autofill-monitor-example.css'], }) export class TextFieldAutofillMonitorExample implements AfterViewInit, OnDestroy { - @ViewChild('first', { read: ElementRef, static: false }) firstName: ElementRef; - @ViewChild('last', { read: ElementRef, static: false }) lastName: ElementRef; + @ViewChild('first', {read: ElementRef}) firstName: ElementRef; + @ViewChild('last', {read: ElementRef}) lastName: ElementRef; firstNameAutofilled: boolean; lastNameAutofilled: boolean; diff --git a/src/material-examples/cdk/text-field/text-field-autosize-textarea/text-field-autosize-textarea-example.ts b/src/material-examples/cdk/text-field/text-field-autosize-textarea/text-field-autosize-textarea-example.ts index bd03fd26c030..0e5beeacd913 100644 --- a/src/material-examples/cdk/text-field/text-field-autosize-textarea/text-field-autosize-textarea-example.ts +++ b/src/material-examples/cdk/text-field/text-field-autosize-textarea/text-field-autosize-textarea-example.ts @@ -11,7 +11,7 @@ import {take} from 'rxjs/operators'; export class TextFieldAutosizeTextareaExample { constructor(private _ngZone: NgZone) {} - @ViewChild('autosize', {static: false}) autosize: CdkTextareaAutosize; + @ViewChild('autosize') autosize: CdkTextareaAutosize; triggerResize() { // Wait for changes to be applied, then trigger textarea resize. diff --git a/src/material-examples/material/chips/chips-autocomplete/chips-autocomplete-example.ts b/src/material-examples/material/chips/chips-autocomplete/chips-autocomplete-example.ts index 623cf273ff36..b75485725577 100644 --- a/src/material-examples/material/chips/chips-autocomplete/chips-autocomplete-example.ts +++ b/src/material-examples/material/chips/chips-autocomplete/chips-autocomplete-example.ts @@ -25,8 +25,8 @@ export class ChipsAutocompleteExample { fruits: string[] = ['Lemon']; allFruits: string[] = ['Apple', 'Lemon', 'Lime', 'Orange', 'Strawberry']; - @ViewChild('fruitInput', {static: false}) fruitInput: ElementRef; - @ViewChild('auto', {static: false}) matAutocomplete: MatAutocomplete; + @ViewChild('fruitInput') fruitInput: ElementRef; + @ViewChild('auto') matAutocomplete: MatAutocomplete; constructor() { this.filteredFruits = this.fruitCtrl.valueChanges.pipe( diff --git a/src/material-examples/material/expansion/expansion-expand-collapse-all/expansion-expand-collapse-all-example.ts b/src/material-examples/material/expansion/expansion-expand-collapse-all/expansion-expand-collapse-all-example.ts index 955e955c587c..d6cdc89971a9 100644 --- a/src/material-examples/material/expansion/expansion-expand-collapse-all/expansion-expand-collapse-all-example.ts +++ b/src/material-examples/material/expansion/expansion-expand-collapse-all/expansion-expand-collapse-all-example.ts @@ -10,5 +10,5 @@ import {MatAccordion} from '@angular/material/expansion'; styleUrls: ['expansion-expand-collapse-all-example.css'], }) export class ExpansionExpandCollapseAllExample { - @ViewChild(MatAccordion, {static: false}) accordion: MatAccordion; + @ViewChild(MatAccordion) accordion: MatAccordion; } diff --git a/src/material-examples/material/sidenav/sidenav-disable-close/sidenav-disable-close-example.ts b/src/material-examples/material/sidenav/sidenav-disable-close/sidenav-disable-close-example.ts index ed5ccda0f633..db846639fc6e 100644 --- a/src/material-examples/material/sidenav/sidenav-disable-close/sidenav-disable-close-example.ts +++ b/src/material-examples/material/sidenav/sidenav-disable-close/sidenav-disable-close-example.ts @@ -8,7 +8,7 @@ import {MatSidenav} from '@angular/material/sidenav'; styleUrls: ['sidenav-disable-close-example.css'], }) export class SidenavDisableCloseExample { - @ViewChild('sidenav', {static: false}) sidenav: MatSidenav; + @ViewChild('sidenav') sidenav: MatSidenav; reason = ''; diff --git a/src/material-examples/material/table/table-http/table-http-example.ts b/src/material-examples/material/table/table-http/table-http-example.ts index 96f6321e2b43..6e07e539e5e3 100644 --- a/src/material-examples/material/table/table-http/table-http-example.ts +++ b/src/material-examples/material/table/table-http/table-http-example.ts @@ -22,8 +22,8 @@ export class TableHttpExample implements AfterViewInit { isLoadingResults = true; isRateLimitReached = false; - @ViewChild(MatPaginator, {static: false}) paginator: MatPaginator; - @ViewChild(MatSort, {static: false}) sort: MatSort; + @ViewChild(MatPaginator) paginator: MatPaginator; + @ViewChild(MatSort) sort: MatSort; constructor(private _httpClient: HttpClient) {} diff --git a/src/material-experimental/mdc-button/button-base.ts b/src/material-experimental/mdc-button/button-base.ts index 6b59908d66a1..144c98facf02 100644 --- a/src/material-experimental/mdc-button/button-base.ts +++ b/src/material-experimental/mdc-button/button-base.ts @@ -95,7 +95,7 @@ export class MatButtonBase extends _MatButtonBaseMixin implements CanDisable, Ca _isRippleCentered = false; /** Reference to the MatRipple instance of the button. */ - @ViewChild(MatRipple, {static: false}) ripple: MatRipple; + @ViewChild(MatRipple) ripple: MatRipple; constructor( elementRef: ElementRef, public _platform: Platform, public _ngZone: NgZone, diff --git a/src/material-experimental/mdc-checkbox/checkbox.ts b/src/material-experimental/mdc-checkbox/checkbox.ts index 42caf4336ddd..28cd0820a63e 100644 --- a/src/material-experimental/mdc-checkbox/checkbox.ts +++ b/src/material-experimental/mdc-checkbox/checkbox.ts @@ -160,13 +160,13 @@ export class MatCheckbox implements AfterViewInit, OnDestroy, ControlValueAccess @Output() readonly indeterminateChange: EventEmitter = new EventEmitter(); /** The root element for the `MDCCheckbox`. */ - @ViewChild('checkbox', {static: false}) _checkbox: ElementRef; + @ViewChild('checkbox') _checkbox: ElementRef; /** The native input element. */ - @ViewChild('nativeCheckbox', {static: false}) _nativeCheckbox: ElementRef; + @ViewChild('nativeCheckbox') _nativeCheckbox: ElementRef; /** The native label element. */ - @ViewChild('label', {static: false}) _label: ElementRef; + @ViewChild('label') _label: ElementRef; /** Returns the unique id for the visual hidden input. */ get inputId(): string { diff --git a/src/material-experimental/mdc-chips/chip-grid.spec.ts b/src/material-experimental/mdc-chips/chip-grid.spec.ts index 8e18ec06d1aa..e456f254473d 100644 --- a/src/material-experimental/mdc-chips/chip-grid.spec.ts +++ b/src/material-experimental/mdc-chips/chip-grid.spec.ts @@ -1034,7 +1034,7 @@ class InputChipGrid { } } - @ViewChild(MatChipGrid, {static: false}) chipGrid: MatChipGrid; + @ViewChild(MatChipGrid) chipGrid: MatChipGrid; @ViewChildren(MatChipRow) chips: QueryList; } @@ -1062,7 +1062,7 @@ class ChipGridWithFormErrorMessages { ]; @ViewChildren(MatChipRow) chips: QueryList; - @ViewChild('form', {static: false}) form: NgForm; + @ViewChild('form') form: NgForm; formControl = new FormControl('', Validators.required); } diff --git a/src/material-experimental/mdc-chips/chip-input.spec.ts b/src/material-experimental/mdc-chips/chip-input.spec.ts index 4eb4e1501fa3..808ed95896b8 100644 --- a/src/material-experimental/mdc-chips/chip-input.spec.ts +++ b/src/material-experimental/mdc-chips/chip-input.spec.ts @@ -260,7 +260,7 @@ describe('MatChipInput', () => { ` }) class TestChipInput { - @ViewChild(MatChipGrid, {static: false}) chipGridInstance: MatChipGrid; + @ViewChild(MatChipGrid) chipGridInstance: MatChipGrid; addOnBlur: boolean = false; placeholder = ''; diff --git a/src/material-experimental/mdc-chips/chip-listbox.spec.ts b/src/material-experimental/mdc-chips/chip-listbox.spec.ts index 5953b73d95fe..9c0d72519356 100644 --- a/src/material-experimental/mdc-chips/chip-listbox.spec.ts +++ b/src/material-experimental/mdc-chips/chip-listbox.spec.ts @@ -844,7 +844,7 @@ class BasicChipListbox { tabIndexOverride: number; selectable: boolean; - @ViewChild(MatChipListbox, {static: false}) chipListbox: MatChipListbox; + @ViewChild(MatChipListbox) chipListbox: MatChipListbox; @ViewChildren(MatChipOption) chips: QueryList; } @@ -875,7 +875,7 @@ class MultiSelectionChipListbox { tabIndexOverride: number; selectable: boolean; - @ViewChild(MatChipListbox, {static: false}) chipListbox: MatChipListbox; + @ViewChild(MatChipListbox) chipListbox: MatChipListbox; @ViewChildren(MatChipOption) chips: QueryList; } diff --git a/src/material-experimental/mdc-chips/chip-option.spec.ts b/src/material-experimental/mdc-chips/chip-option.spec.ts index 99947c134b5b..d6f0d0bb12b2 100644 --- a/src/material-experimental/mdc-chips/chip-option.spec.ts +++ b/src/material-experimental/mdc-chips/chip-option.spec.ts @@ -292,7 +292,7 @@ describe('Option Chips', () => { ` }) class SingleChip { - @ViewChild(MatChipListbox, {static: false}) chipList: MatChipListbox; + @ViewChild(MatChipListbox) chipList: MatChipListbox; disabled: boolean = false; name: string = 'Test'; color: string = 'primary'; diff --git a/src/material-experimental/mdc-chips/chip-row.spec.ts b/src/material-experimental/mdc-chips/chip-row.spec.ts index b01c77299efd..0de90a3030a7 100644 --- a/src/material-experimental/mdc-chips/chip-row.spec.ts +++ b/src/material-experimental/mdc-chips/chip-row.spec.ts @@ -234,7 +234,7 @@ describe('Row Chips', () => { ` }) class SingleChip { - @ViewChild(MatChipGrid, {static: false}) chipList: MatChipGrid; + @ViewChild(MatChipGrid) chipList: MatChipGrid; disabled: boolean = false; name: string = 'Test'; color: string = 'primary'; diff --git a/src/material-experimental/mdc-chips/chip-row.ts b/src/material-experimental/mdc-chips/chip-row.ts index 87ddbb2ab701..92fd78374403 100644 --- a/src/material-experimental/mdc-chips/chip-row.ts +++ b/src/material-experimental/mdc-chips/chip-row.ts @@ -58,7 +58,7 @@ export class MatChipRow extends MatChip implements AfterContentInit, AfterViewIn * The focusable wrapper element in the first gridcell, which contains all * chip content other than the remove icon. */ - @ViewChild('chipContent', {static: false}) chipContent: ElementRef; + @ViewChild('chipContent') chipContent: ElementRef; /** The focusable grid cells for this row. Implemented as part of GridKeyManagerRow. */ cells!: HTMLElement[]; diff --git a/src/material-experimental/mdc-chips/chip.spec.ts b/src/material-experimental/mdc-chips/chip.spec.ts index 0831fdafb7ad..141f1cd7de57 100644 --- a/src/material-experimental/mdc-chips/chip.spec.ts +++ b/src/material-experimental/mdc-chips/chip.spec.ts @@ -170,7 +170,7 @@ describe('MatChip', () => { ` }) class SingleChip { - @ViewChild(MatChipSet, {static: false}) chipList: MatChipSet; + @ViewChild(MatChipSet) chipList: MatChipSet; disabled: boolean = false; name: string = 'Test'; color: string = 'primary'; diff --git a/src/material-experimental/mdc-chips/chip.ts b/src/material-experimental/mdc-chips/chip.ts index 0d550e4b7784..339261f41700 100644 --- a/src/material-experimental/mdc-chips/chip.ts +++ b/src/material-experimental/mdc-chips/chip.ts @@ -223,13 +223,13 @@ export class MatChip extends _MatChipMixinBase implements AfterContentInit, Afte } /** The chip's leading icon. */ - @ContentChild(MatChipAvatar, {static: false}) leadingIcon: MatChipAvatar; + @ContentChild(MatChipAvatar) leadingIcon: MatChipAvatar; /** The chip's trailing icon. */ - @ContentChild(MatChipTrailingIcon, {static: false}) trailingIcon: MatChipTrailingIcon; + @ContentChild(MatChipTrailingIcon) trailingIcon: MatChipTrailingIcon; /** The chip's trailing remove icon. */ - @ContentChild(MatChipRemove, {static: false}) removeIcon: MatChipRemove; + @ContentChild(MatChipRemove) removeIcon: MatChipRemove; /** * Implementation of the MDC chip adapter interface. diff --git a/src/material-experimental/mdc-menu/menu.spec.ts b/src/material-experimental/mdc-menu/menu.spec.ts index 603d95882fe4..983be196506e 100644 --- a/src/material-experimental/mdc-menu/menu.spec.ts +++ b/src/material-experimental/mdc-menu/menu.spec.ts @@ -2132,9 +2132,9 @@ describe('MatMenu default overrides', () => { ` }) class SimpleMenu { - @ViewChild(MatMenuTrigger, {static: false}) trigger: MatMenuTrigger; - @ViewChild('triggerEl', {static: false}) triggerEl: ElementRef; - @ViewChild(MatMenu, {static: false}) menu: MatMenu; + @ViewChild(MatMenuTrigger) trigger: MatMenuTrigger; + @ViewChild('triggerEl') triggerEl: ElementRef; + @ViewChild(MatMenu) menu: MatMenu; @ViewChildren(MatMenuItem) items: QueryList; extraItems: string[] = []; closeCallback = jasmine.createSpy('menu closed callback'); @@ -2152,8 +2152,8 @@ class SimpleMenu { ` }) class PositionedMenu { - @ViewChild(MatMenuTrigger, {static: false}) trigger: MatMenuTrigger; - @ViewChild('triggerEl', {static: false}) triggerEl: ElementRef; + @ViewChild(MatMenuTrigger) trigger: MatMenuTrigger; + @ViewChild('triggerEl') triggerEl: ElementRef; xPosition: MenuPositionX = 'before'; yPosition: MenuPositionY = 'above'; } @@ -2172,8 +2172,8 @@ interface TestableMenu { }) class OverlapMenu implements TestableMenu { @Input() overlapTrigger: boolean; - @ViewChild(MatMenuTrigger, {static: false}) trigger: MatMenuTrigger; - @ViewChild('triggerEl', {static: false}) triggerEl: ElementRef; + @ViewChild(MatMenuTrigger) trigger: MatMenuTrigger; + @ViewChild('triggerEl') triggerEl: ElementRef; } @Component({ @@ -2193,7 +2193,7 @@ class CustomMenuPanel implements MatMenuPanel { overlapTrigger = true; parentMenu: MatMenuPanel; - @ViewChild(TemplateRef, {static: false}) templateRef: TemplateRef; + @ViewChild(TemplateRef) templateRef: TemplateRef; @Output() close = new EventEmitter(); focusFirstItem = () => {}; resetActiveItem = () => {}; @@ -2209,7 +2209,7 @@ class CustomMenuPanel implements MatMenuPanel { ` }) class CustomMenu { - @ViewChild(MatMenuTrigger, {static: false}) trigger: MatMenuTrigger; + @ViewChild(MatMenuTrigger) trigger: MatMenuTrigger; } @@ -2260,22 +2260,22 @@ class CustomMenu { ` }) class NestedMenu { - @ViewChild('root', {static: false}) rootMenu: MatMenu; - @ViewChild('rootTrigger', {static: false}) rootTrigger: MatMenuTrigger; - @ViewChild('rootTriggerEl', {static: false}) rootTriggerEl: ElementRef; - @ViewChild('alternateTrigger', {static: false}) alternateTrigger: MatMenuTrigger; + @ViewChild('root') rootMenu: MatMenu; + @ViewChild('rootTrigger') rootTrigger: MatMenuTrigger; + @ViewChild('rootTriggerEl') rootTriggerEl: ElementRef; + @ViewChild('alternateTrigger') alternateTrigger: MatMenuTrigger; readonly rootCloseCallback = jasmine.createSpy('root menu closed callback'); - @ViewChild('levelOne', {static: false}) levelOneMenu: MatMenu; - @ViewChild('levelOneTrigger', {static: false}) levelOneTrigger: MatMenuTrigger; + @ViewChild('levelOne') levelOneMenu: MatMenu; + @ViewChild('levelOneTrigger') levelOneTrigger: MatMenuTrigger; readonly levelOneCloseCallback = jasmine.createSpy('level one menu closed callback'); - @ViewChild('levelTwo', {static: false}) levelTwoMenu: MatMenu; - @ViewChild('levelTwoTrigger', {static: false}) levelTwoTrigger: MatMenuTrigger; + @ViewChild('levelTwo') levelTwoMenu: MatMenu; + @ViewChild('levelTwoTrigger') levelTwoTrigger: MatMenuTrigger; readonly levelTwoCloseCallback = jasmine.createSpy('level one menu closed callback'); - @ViewChild('lazy', {static: false}) lazyMenu: MatMenu; - @ViewChild('lazyTrigger', {static: false}) lazyTrigger: MatMenuTrigger; + @ViewChild('lazy') lazyMenu: MatMenu; + @ViewChild('lazyTrigger') lazyTrigger: MatMenuTrigger; showLazy = false; } @@ -2295,8 +2295,8 @@ class NestedMenu { ` }) class NestedMenuCustomElevation { - @ViewChild('rootTrigger', {static: false}) rootTrigger: MatMenuTrigger; - @ViewChild('levelOneTrigger', {static: false}) levelOneTrigger: MatMenuTrigger; + @ViewChild('rootTrigger') rootTrigger: MatMenuTrigger; + @ViewChild('levelOneTrigger') levelOneTrigger: MatMenuTrigger; } @@ -2318,8 +2318,8 @@ class NestedMenuCustomElevation { ` }) class NestedMenuRepeater { - @ViewChild('rootTriggerEl', {static: false}) rootTriggerEl: ElementRef; - @ViewChild('levelOneTrigger', {static: false}) levelOneTrigger: MatMenuTrigger; + @ViewChild('rootTriggerEl') rootTriggerEl: ElementRef; + @ViewChild('levelOneTrigger') levelOneTrigger: MatMenuTrigger; items = ['one', 'two', 'three']; } @@ -2339,7 +2339,7 @@ class NestedMenuRepeater { ` }) class SubmenuDeclaredInsideParentMenu { - @ViewChild('rootTriggerEl', {static: false}) rootTriggerEl: ElementRef; + @ViewChild('rootTriggerEl') rootTriggerEl: ElementRef; } @@ -2363,8 +2363,8 @@ class FakeIcon {} ` }) class SimpleLazyMenu { - @ViewChild(MatMenuTrigger, {static: false}) trigger: MatMenuTrigger; - @ViewChild('triggerEl', {static: false}) triggerEl: ElementRef; + @ViewChild(MatMenuTrigger) trigger: MatMenuTrigger; + @ViewChild('triggerEl') triggerEl: ElementRef; @ViewChildren(MatMenuItem) items: QueryList; } @@ -2389,8 +2389,8 @@ class SimpleLazyMenu { ` }) class LazyMenuWithContext { - @ViewChild('triggerOne', {static: false}) triggerOne: MatMenuTrigger; - @ViewChild('triggerTwo', {static: false}) triggerTwo: MatMenuTrigger; + @ViewChild('triggerOne') triggerOne: MatMenuTrigger; + @ViewChild('triggerTwo') triggerTwo: MatMenuTrigger; } @@ -2408,9 +2408,9 @@ class LazyMenuWithContext { ` }) class DynamicPanelMenu { - @ViewChild(MatMenuTrigger, {static: false}) trigger: MatMenuTrigger; - @ViewChild('one', {static: false}) firstMenu: MatMenu; - @ViewChild('two', {static: false}) secondMenu: MatMenu; + @ViewChild(MatMenuTrigger) trigger: MatMenuTrigger; + @ViewChild('one') firstMenu: MatMenu; + @ViewChild('two') secondMenu: MatMenu; } @@ -2425,7 +2425,7 @@ class DynamicPanelMenu { ` }) class MenuWithCheckboxItems { - @ViewChild(MatMenuTrigger, {static: false}) trigger: MatMenuTrigger; + @ViewChild(MatMenuTrigger) trigger: MatMenuTrigger; } @@ -2441,7 +2441,7 @@ class MenuWithCheckboxItems { ` }) class SimpleMenuWithRepeater { - @ViewChild(MatMenuTrigger, {static: false}) trigger: MatMenuTrigger; - @ViewChild(MatMenu, {static: false}) menu: MatMenu; + @ViewChild(MatMenuTrigger) trigger: MatMenuTrigger; + @ViewChild(MatMenu) menu: MatMenu; items = [{label: 'Pizza', disabled: false}, {label: 'Pasta', disabled: false}]; } diff --git a/src/material-experimental/mdc-slide-toggle/slide-toggle.ts b/src/material-experimental/mdc-slide-toggle/slide-toggle.ts index 5a3409597e2b..bcee35b5c06f 100644 --- a/src/material-experimental/mdc-slide-toggle/slide-toggle.ts +++ b/src/material-experimental/mdc-slide-toggle/slide-toggle.ts @@ -200,7 +200,7 @@ export class MatSlideToggle implements ControlValueAccessor, AfterViewInit, OnDe get inputId(): string { return `${this.id || this._uniqueId}-input`; } /** Reference to the underlying input element. */ - @ViewChild('input', {static: false}) _inputElement: ElementRef; + @ViewChild('input') _inputElement: ElementRef; constructor(private _changeDetectorRef: ChangeDetectorRef, @Attribute('tabindex') tabIndex: string, diff --git a/src/material-experimental/mdc-slider/slider.spec.ts b/src/material-experimental/mdc-slider/slider.spec.ts index ac45b09e3c5f..a579d2b11e54 100644 --- a/src/material-experimental/mdc-slider/slider.spec.ts +++ b/src/material-experimental/mdc-slider/slider.spec.ts @@ -1332,7 +1332,7 @@ class SliderWithFormControl { styles: [styles], }) class SliderWithNgModel { - @ViewChild(MatSlider, {static: false}) slider: MatSlider; + @ViewChild(MatSlider) slider: MatSlider; val: number | undefined = 0; } @@ -1358,7 +1358,7 @@ class SliderWithChangeHandler { onChange() { } onInput() { } - @ViewChild(MatSlider, {static: false}) slider: MatSlider; + @ViewChild(MatSlider) slider: MatSlider; } @Component({ @@ -1391,7 +1391,7 @@ class SliderWithNativeTabindexAttr { styles: [styles], }) class SliderWithTwoWayBinding { - @ViewChild(MatSlider, {static: false}) slider: MatSlider; + @ViewChild(MatSlider) slider: MatSlider; value = 0; } diff --git a/src/material-experimental/mdc-slider/slider.ts b/src/material-experimental/mdc-slider/slider.ts index 99d874bdb844..cb1484157c02 100644 --- a/src/material-experimental/mdc-slider/slider.ts +++ b/src/material-experimental/mdc-slider/slider.ts @@ -313,10 +313,10 @@ export class MatSlider implements AfterViewInit, OnChanges, OnDestroy, ControlVa /** Function that marks the slider as touched. Registered via "registerOnTouch". */ _markAsTouched: () => any = () => {}; - @ViewChild('thumbContainer', {static: false}) _thumbContainer: ElementRef; - @ViewChild('track', {static: false}) _track: ElementRef; - @ViewChild('pinValueMarker', {static: false}) _pinValueMarker: ElementRef; - @ViewChild('trackMarker', {static: false}) _trackMarker: ElementRef; + @ViewChild('thumbContainer') _thumbContainer: ElementRef; + @ViewChild('track') _track: ElementRef; + @ViewChild('pinValueMarker') _pinValueMarker: ElementRef; + @ViewChild('trackMarker') _trackMarker: ElementRef; constructor( private _elementRef: ElementRef, diff --git a/src/material-experimental/mdc-tabs/tab-body.spec.ts b/src/material-experimental/mdc-tabs/tab-body.spec.ts index 0ba0a1cf96be..435fe329e432 100644 --- a/src/material-experimental/mdc-tabs/tab-body.spec.ts +++ b/src/material-experimental/mdc-tabs/tab-body.spec.ts @@ -192,7 +192,7 @@ class SimpleTabBodyApp implements AfterContentInit { position: number; origin: number | null; - @ViewChild(MatTabBody, {static: false}) tabBody: MatTabBody; + @ViewChild(MatTabBody) tabBody: MatTabBody; @ViewChild(TemplateRef, {static: true}) template: TemplateRef; constructor(private _viewContainerRef: ViewContainerRef) { } diff --git a/src/material-experimental/mdc-tabs/tab-body.ts b/src/material-experimental/mdc-tabs/tab-body.ts index a78c78bb967e..debafe39f15f 100644 --- a/src/material-experimental/mdc-tabs/tab-body.ts +++ b/src/material-experimental/mdc-tabs/tab-body.ts @@ -61,7 +61,7 @@ export class MatTabBodyPortal extends BaseMatTabBodyPortal { }, }) export class MatTabBody extends _MatTabBodyBase { - @ViewChild(PortalHostDirective, {static: false}) _portalHost: PortalHostDirective; + @ViewChild(PortalHostDirective) _portalHost: PortalHostDirective; constructor(elementRef: ElementRef, @Optional() dir: Directionality, diff --git a/src/material-experimental/mdc-tabs/tab-group.spec.ts b/src/material-experimental/mdc-tabs/tab-group.spec.ts index 47d35e037782..f3a8659804ce 100644 --- a/src/material-experimental/mdc-tabs/tab-group.spec.ts +++ b/src/material-experimental/mdc-tabs/tab-group.spec.ts @@ -836,7 +836,7 @@ class AsyncTabsTestApp implements OnInit { class TabGroupWithSimpleApi { otherLabel = 'Fruit'; otherContent = 'Apples, grapes'; - @ViewChild('legumes', {static: false}) legumes: any; + @ViewChild('legumes') legumes: any; } @@ -926,5 +926,5 @@ class TabsWithCustomAnimationDuration {} `, }) class TabGroupWithIndirectDescendantTabs { - @ViewChild(MatTabGroup, {static: false}) tabGroup: MatTabGroup; + @ViewChild(MatTabGroup) tabGroup: MatTabGroup; } diff --git a/src/material-experimental/mdc-tabs/tab-group.ts b/src/material-experimental/mdc-tabs/tab-group.ts index ccb67e789294..c4b078b403a6 100644 --- a/src/material-experimental/mdc-tabs/tab-group.ts +++ b/src/material-experimental/mdc-tabs/tab-group.ts @@ -54,8 +54,8 @@ import {MatTabHeader} from './tab-header'; }) export class MatTabGroup extends _MatTabGroupBase { @ContentChildren(MatTab, {descendants: true}) _allTabs: QueryList; - @ViewChild('tabBodyWrapper', {static: false}) _tabBodyWrapper: ElementRef; - @ViewChild('tabHeader', {static: false}) _tabHeader: MatTabHeader; + @ViewChild('tabBodyWrapper') _tabBodyWrapper: ElementRef; + @ViewChild('tabHeader') _tabHeader: MatTabHeader; constructor(elementRef: ElementRef, changeDetectorRef: ChangeDetectorRef, diff --git a/src/material-experimental/mdc-tabs/tab-header.ts b/src/material-experimental/mdc-tabs/tab-header.ts index 82c5481ad8c3..14111ebb0cd0 100644 --- a/src/material-experimental/mdc-tabs/tab-header.ts +++ b/src/material-experimental/mdc-tabs/tab-header.ts @@ -54,8 +54,8 @@ export class MatTabHeader extends _MatTabHeaderBase implements AfterContentInit @ContentChildren(MatTabLabelWrapper) _items: QueryList; @ViewChild('tabListContainer', {static: true}) _tabListContainer: ElementRef; @ViewChild('tabList', {static: true}) _tabList: ElementRef; - @ViewChild('nextPaginator', {static: false}) _nextPaginator: ElementRef; - @ViewChild('previousPaginator', {static: false}) _previousPaginator: ElementRef; + @ViewChild('nextPaginator') _nextPaginator: ElementRef; + @ViewChild('previousPaginator') _previousPaginator: ElementRef; _inkBar: MatInkBar; constructor(elementRef: ElementRef, diff --git a/src/material-experimental/mdc-tabs/tab-nav-bar/tab-nav-bar.spec.ts b/src/material-experimental/mdc-tabs/tab-nav-bar/tab-nav-bar.spec.ts index df78f8b2a04b..351ed193f395 100644 --- a/src/material-experimental/mdc-tabs/tab-nav-bar/tab-nav-bar.spec.ts +++ b/src/material-experimental/mdc-tabs/tab-nav-bar/tab-nav-bar.spec.ts @@ -339,7 +339,7 @@ describe('MatTabNavBar', () => { ` }) class SimpleTabNavBarTestApp { - @ViewChild(MatTabNav, {static: false}) tabNavBar: MatTabNav; + @ViewChild(MatTabNav) tabNavBar: MatTabNav; @ViewChildren(MatTabLink) tabLinks: QueryList; label = ''; diff --git a/src/material-experimental/mdc-tabs/tab-nav-bar/tab-nav-bar.ts b/src/material-experimental/mdc-tabs/tab-nav-bar/tab-nav-bar.ts index 90cf2225b471..3a5cffbbeeb0 100644 --- a/src/material-experimental/mdc-tabs/tab-nav-bar/tab-nav-bar.ts +++ b/src/material-experimental/mdc-tabs/tab-nav-bar/tab-nav-bar.ts @@ -59,8 +59,8 @@ export class MatTabNav extends _MatTabNavBase implements AfterContentInit { @ContentChildren(forwardRef(() => MatTabLink), {descendants: true}) _items: QueryList; @ViewChild('tabListContainer', {static: true}) _tabListContainer: ElementRef; @ViewChild('tabList', {static: true}) _tabList: ElementRef; - @ViewChild('nextPaginator', {static: false}) _nextPaginator: ElementRef; - @ViewChild('previousPaginator', {static: false}) _previousPaginator: ElementRef; + @ViewChild('nextPaginator') _nextPaginator: ElementRef; + @ViewChild('previousPaginator') _previousPaginator: ElementRef; _inkBar: MatInkBar; constructor(elementRef: ElementRef, diff --git a/src/material-experimental/mdc-tabs/tab.ts b/src/material-experimental/mdc-tabs/tab.ts index c354577f808c..c7ff7d54435e 100644 --- a/src/material-experimental/mdc-tabs/tab.ts +++ b/src/material-experimental/mdc-tabs/tab.ts @@ -38,5 +38,5 @@ export class MatTab extends BaseMatTab { _explicitContent: TemplateRef; /** Content for the tab label given by ``. */ - @ContentChild(MatTabLabel, {static: false}) templateLabel: MatTabLabel; + @ContentChild(MatTabLabel) templateLabel: MatTabLabel; } diff --git a/src/material-experimental/popover-edit/popover-edit.spec.ts b/src/material-experimental/popover-edit/popover-edit.spec.ts index c48f6714f050..51c2de462e09 100644 --- a/src/material-experimental/popover-edit/popover-edit.spec.ts +++ b/src/material-experimental/popover-edit/popover-edit.spec.ts @@ -64,7 +64,7 @@ interface PeriodicElement { selector: 'do-not-use-abstract-mat-popover-edit-base-test-component' }) abstract class BaseTestComponent { - @ViewChild('table', {static: false}) table: ElementRef; + @ViewChild('table') table: ElementRef; preservedValues = new FormValueContainer(); diff --git a/src/material/autocomplete/autocomplete.spec.ts b/src/material/autocomplete/autocomplete.spec.ts index f71a537631c6..87083f8c7476 100644 --- a/src/material/autocomplete/autocomplete.spec.ts +++ b/src/material/autocomplete/autocomplete.spec.ts @@ -2549,8 +2549,8 @@ class SimpleAutocomplete implements OnDestroy { closedSpy = jasmine.createSpy('autocomplete closed spy'); @ViewChild(MatAutocompleteTrigger, {static: true}) trigger: MatAutocompleteTrigger; - @ViewChild(MatAutocomplete, {static: false}) panel: MatAutocomplete; - @ViewChild(MatFormField, {static: false}) formField: MatFormField; + @ViewChild(MatAutocomplete) panel: MatAutocomplete; + @ViewChild(MatFormField) formField: MatFormField; @ViewChildren(MatOption) options: QueryList; states = [ @@ -2608,7 +2608,7 @@ class NgIfAutocomplete { isVisible = true; options = ['One', 'Two', 'Three']; - @ViewChild(MatAutocompleteTrigger, {static: false}) trigger: MatAutocompleteTrigger; + @ViewChild(MatAutocompleteTrigger) trigger: MatAutocompleteTrigger; @ViewChildren(MatOption) matOptions: QueryList; constructor() { @@ -2709,7 +2709,7 @@ class AutocompleteWithNumbers { ` }) class AutocompleteWithOnPushDelay implements OnInit { - @ViewChild(MatAutocompleteTrigger, {static: false}) trigger: MatAutocompleteTrigger; + @ViewChild(MatAutocompleteTrigger) trigger: MatAutocompleteTrigger; options: string[]; ngOnInit() { @@ -2735,7 +2735,7 @@ class AutocompleteWithNativeInput { filteredOptions: Observable; options = ['En', 'To', 'Tre', 'Fire', 'Fem']; - @ViewChild(MatAutocompleteTrigger, {static: false}) trigger: MatAutocompleteTrigger; + @ViewChild(MatAutocompleteTrigger) trigger: MatAutocompleteTrigger; @ViewChildren(MatOption) matOptions: QueryList; constructor() { @@ -2753,7 +2753,7 @@ class AutocompleteWithNativeInput { template: `` }) class AutocompleteWithoutPanel { - @ViewChild(MatAutocompleteTrigger, {static: false}) trigger: MatAutocompleteTrigger; + @ViewChild(MatAutocompleteTrigger) trigger: MatAutocompleteTrigger; control = new FormControl(); } @@ -2790,7 +2790,7 @@ class AutocompleteWithFormsAndNonfloatingLabel { ` }) class AutocompleteWithGroups { - @ViewChild(MatAutocompleteTrigger, {static: false}) trigger: MatAutocompleteTrigger; + @ViewChild(MatAutocompleteTrigger) trigger: MatAutocompleteTrigger; selectedState: string; stateGroups = [ { @@ -2826,8 +2826,8 @@ class AutocompleteWithSelectEvent { states = ['New York', 'Washington', 'Oregon']; optionSelected = jasmine.createSpy('optionSelected callback'); - @ViewChild(MatAutocompleteTrigger, {static: false}) trigger: MatAutocompleteTrigger; - @ViewChild(MatAutocomplete, {static: false}) autocomplete: MatAutocomplete; + @ViewChild(MatAutocompleteTrigger) trigger: MatAutocompleteTrigger; + @ViewChild(MatAutocomplete) autocomplete: MatAutocomplete; } @@ -2885,8 +2885,8 @@ class AutocompleteWithNumberInputAndNgModel { ` }) class AutocompleteWithDifferentOrigin { - @ViewChild(MatAutocompleteTrigger, {static: false}) trigger: MatAutocompleteTrigger; - @ViewChild(MatAutocompleteOrigin, {static: false}) alternateOrigin: MatAutocompleteOrigin; + @ViewChild(MatAutocompleteTrigger) trigger: MatAutocompleteTrigger; + @ViewChild(MatAutocompleteOrigin) alternateOrigin: MatAutocompleteOrigin; selectedValue: string; values = ['one', 'two', 'three']; connectedTo?: MatAutocompleteOrigin; diff --git a/src/material/autocomplete/autocomplete.ts b/src/material/autocomplete/autocomplete.ts index ffd08c6a3af9..53ae7f9deefa 100644 --- a/src/material/autocomplete/autocomplete.ts +++ b/src/material/autocomplete/autocomplete.ts @@ -112,7 +112,7 @@ export class MatAutocomplete extends _MatAutocompleteMixinBase implements AfterC @ViewChild(TemplateRef, {static: true}) template: TemplateRef; /** Element for the panel containing the autocomplete options. */ - @ViewChild('panel', {static: false}) panel: ElementRef; + @ViewChild('panel') panel: ElementRef; /** @docs-private */ @ContentChildren(MatOption, {descendants: true}) options: QueryList; diff --git a/src/material/badge/badge.spec.ts b/src/material/badge/badge.spec.ts index f2d64c876ff3..7dd3760bb915 100644 --- a/src/material/badge/badge.spec.ts +++ b/src/material/badge/badge.spec.ts @@ -232,7 +232,7 @@ describe('MatBadge', () => { ` }) class BadgeTestApp { - @ViewChild(MatBadge, {static: false}) badgeInstance: MatBadge; + @ViewChild(MatBadge) badgeInstance: MatBadge; badgeColor: ThemePalette; badgeContent: string | number = '1'; badgeDirection = 'above after'; diff --git a/src/material/bottom-sheet/bottom-sheet.spec.ts b/src/material/bottom-sheet/bottom-sheet.spec.ts index b40847b9e912..f37e214e415a 100644 --- a/src/material/bottom-sheet/bottom-sheet.spec.ts +++ b/src/material/bottom-sheet/bottom-sheet.spec.ts @@ -856,9 +856,7 @@ class DirectiveWithViewContainer { @Component({template: ``}) class ComponentWithChildViewContainer { - @ViewChild(DirectiveWithViewContainer, { - static: false - }) childWithViewContainer: DirectiveWithViewContainer; + @ViewChild(DirectiveWithViewContainer) childWithViewContainer: DirectiveWithViewContainer; get childViewContainer() { return this.childWithViewContainer.viewContainerRef; @@ -874,7 +872,7 @@ class ComponentWithTemplateRef { localValue: string; bottomSheetRef: MatBottomSheetRef; - @ViewChild(TemplateRef, {static: false}) templateRef: TemplateRef; + @ViewChild(TemplateRef) templateRef: TemplateRef; setRef(bottomSheetRef: MatBottomSheetRef): string { this.bottomSheetRef = bottomSheetRef; diff --git a/src/material/button-toggle/button-toggle.spec.ts b/src/material/button-toggle/button-toggle.spec.ts index ac532b325a43..5f126db22777 100644 --- a/src/material/button-toggle/button-toggle.spec.ts +++ b/src/material/button-toggle/button-toggle.spec.ts @@ -1025,7 +1025,7 @@ class ButtonToggleWithAriaLabelledby {} ` }) class RepeatedButtonTogglesWithPreselectedValue { - @ViewChild(MatButtonToggleGroup, {static: false}) toggleGroup: MatButtonToggleGroup; + @ViewChild(MatButtonToggleGroup) toggleGroup: MatButtonToggleGroup; @ViewChildren(MatButtonToggle) toggles: QueryList; possibleValues = ['One', 'Two', 'Three']; diff --git a/src/material/button-toggle/button-toggle.ts b/src/material/button-toggle/button-toggle.ts index d0a341fc9e45..6d24e5459273 100644 --- a/src/material/button-toggle/button-toggle.ts +++ b/src/material/button-toggle/button-toggle.ts @@ -420,7 +420,7 @@ export class MatButtonToggle extends _MatButtonToggleMixinBase implements OnInit /** Type of the button toggle. Either 'radio' or 'checkbox'. */ _type: ToggleType; - @ViewChild('button', {static: false}) _buttonElement: ElementRef; + @ViewChild('button') _buttonElement: ElementRef; /** The parent button toggle group (exclusive selection). Optional. */ buttonToggleGroup: MatButtonToggleGroup; diff --git a/src/material/button/button.ts b/src/material/button/button.ts index 4f3860c3aa06..0f3bda49c9e7 100644 --- a/src/material/button/button.ts +++ b/src/material/button/button.ts @@ -87,7 +87,7 @@ export class MatButton extends _MatButtonMixinBase readonly isIconButton: boolean = this._hasHostAttributes('mat-icon-button'); /** Reference to the MatRipple instance of the button. */ - @ViewChild(MatRipple, {static: false}) ripple: MatRipple; + @ViewChild(MatRipple) ripple: MatRipple; constructor(elementRef: ElementRef, private _focusMonitor: FocusMonitor, diff --git a/src/material/checkbox/checkbox.spec.ts b/src/material/checkbox/checkbox.spec.ts index abc06f75f035..65b3c2781407 100644 --- a/src/material/checkbox/checkbox.spec.ts +++ b/src/material/checkbox/checkbox.spec.ts @@ -1237,7 +1237,7 @@ class CheckboxWithTabIndex { `, }) class CheckboxUsingViewChild { - @ViewChild(MatCheckbox, {static: false}) checkbox: MatCheckbox; + @ViewChild(MatCheckbox) checkbox: MatCheckbox; set isDisabled(value: boolean) { this.checkbox.disabled = value; diff --git a/src/material/checkbox/checkbox.ts b/src/material/checkbox/checkbox.ts index 2968647c32f6..818b6a72bd35 100644 --- a/src/material/checkbox/checkbox.ts +++ b/src/material/checkbox/checkbox.ts @@ -172,10 +172,10 @@ export class MatCheckbox extends _MatCheckboxMixinBase implements ControlValueAc @Input() value: string; /** The native `` element */ - @ViewChild('input', {static: false}) _inputElement: ElementRef; + @ViewChild('input') _inputElement: ElementRef; /** Reference to the ripple instance of the checkbox. */ - @ViewChild(MatRipple, {static: false}) ripple: MatRipple; + @ViewChild(MatRipple) ripple: MatRipple; /** * Called when the checkbox is blurred. Needed to properly implement ControlValueAccessor. diff --git a/src/material/chips/chip-input.spec.ts b/src/material/chips/chip-input.spec.ts index 4828d6d16261..9465b7e45b84 100644 --- a/src/material/chips/chip-input.spec.ts +++ b/src/material/chips/chip-input.spec.ts @@ -256,7 +256,7 @@ describe('MatChipInput', () => { ` }) class TestChipInput { - @ViewChild(MatChipList, {static: false}) chipListInstance: MatChipList; + @ViewChild(MatChipList) chipListInstance: MatChipList; addOnBlur: boolean = false; placeholder = ''; diff --git a/src/material/chips/chip-list.spec.ts b/src/material/chips/chip-list.spec.ts index 442376f2c819..d18f6e534a52 100644 --- a/src/material/chips/chip-list.spec.ts +++ b/src/material/chips/chip-list.spec.ts @@ -1411,7 +1411,7 @@ class BasicChipList { tabIndexOverride: number; selectable: boolean; - @ViewChild(MatChipList, {static: false}) chipList: MatChipList; + @ViewChild(MatChipList) chipList: MatChipList; @ViewChildren(MatChip) chips: QueryList; } @@ -1446,7 +1446,7 @@ class MultiSelectionChipList { tabIndexOverride: number; selectable: boolean; - @ViewChild(MatChipList, {static: false}) chipList: MatChipList; + @ViewChild(MatChipList) chipList: MatChipList; @ViewChildren(MatChip) chips: QueryList; } @@ -1511,7 +1511,7 @@ class InputChipList { } } - @ViewChild(MatChipList, {static: false}) chipList: MatChipList; + @ViewChild(MatChipList) chipList: MatChipList; @ViewChildren(MatChip) chips: QueryList; } @@ -1574,7 +1574,7 @@ class ChipListWithFormErrorMessages { ]; @ViewChildren(MatChip) chips: QueryList; - @ViewChild('form', {static: false}) form: NgForm; + @ViewChild('form') form: NgForm; formControl = new FormControl('', Validators.required); } diff --git a/src/material/chips/chip.spec.ts b/src/material/chips/chip.spec.ts index ebcdd340057a..2b3344e28d96 100644 --- a/src/material/chips/chip.spec.ts +++ b/src/material/chips/chip.spec.ts @@ -421,7 +421,7 @@ describe('MatChip', () => { ` }) class SingleChip { - @ViewChild(MatChipList, {static: false}) chipList: MatChipList; + @ViewChild(MatChipList) chipList: MatChipList; disabled: boolean = false; name: string = 'Test'; color: string = 'primary'; diff --git a/src/material/chips/chip.ts b/src/material/chips/chip.ts index 94e78472b5a4..fce9cb5ce0ad 100644 --- a/src/material/chips/chip.ts +++ b/src/material/chips/chip.ts @@ -152,13 +152,13 @@ export class MatChip extends _MatChipMixinBase implements FocusableOption, OnDes _chipListMultiple: boolean = false; /** The chip avatar */ - @ContentChild(MatChipAvatar, {static: false}) avatar: MatChipAvatar; + @ContentChild(MatChipAvatar) avatar: MatChipAvatar; /** The chip's trailing icon. */ - @ContentChild(MatChipTrailingIcon, {static: false}) trailingIcon: MatChipTrailingIcon; + @ContentChild(MatChipTrailingIcon) trailingIcon: MatChipTrailingIcon; /** The chip's remove toggler. */ - @ContentChild(forwardRef(() => MatChipRemove), {static: false}) removeIcon: MatChipRemove; + @ContentChild(forwardRef(() => MatChipRemove)) removeIcon: MatChipRemove; /** Whether the chip is selected. */ @Input() diff --git a/src/material/core/ripple/ripple.spec.ts b/src/material/core/ripple/ripple.spec.ts index a5d8d72d7443..6383c3eff773 100644 --- a/src/material/core/ripple/ripple.spec.ts +++ b/src/material/core/ripple/ripple.spec.ts @@ -728,7 +728,7 @@ describe('MatRipple', () => { `, }) class BasicRippleContainer { - @ViewChild('ripple', {static: false}) ripple: MatRipple; + @ViewChild('ripple') ripple: MatRipple; } @Component({ @@ -752,7 +752,7 @@ class RippleContainerWithInputBindings { disabled = false; radius = 0; color = ''; - @ViewChild(MatRipple, {static: false}) ripple: MatRipple; + @ViewChild(MatRipple) ripple: MatRipple; } @Component({ @@ -763,6 +763,6 @@ class RippleContainerWithoutBindings {} @Component({ template: `
` }) class RippleContainerWithNgIf { - @ViewChild(MatRipple, {static: false}) ripple: MatRipple; + @ViewChild(MatRipple) ripple: MatRipple; isDestroyed = false; } diff --git a/src/material/datepicker/calendar.ts b/src/material/datepicker/calendar.ts index c47a3f5e27e4..d774087e3270 100644 --- a/src/material/datepicker/calendar.ts +++ b/src/material/datepicker/calendar.ts @@ -258,13 +258,13 @@ export class MatCalendar implements AfterContentInit, AfterViewChecked, OnDes @Output() readonly _userSelection: EventEmitter = new EventEmitter(); /** Reference to the current month view component. */ - @ViewChild(MatMonthView, {static: false}) monthView: MatMonthView; + @ViewChild(MatMonthView) monthView: MatMonthView; /** Reference to the current year view component. */ - @ViewChild(MatYearView, {static: false}) yearView: MatYearView; + @ViewChild(MatYearView) yearView: MatYearView; /** Reference to the current multi-year view component. */ - @ViewChild(MatMultiYearView, {static: false}) multiYearView: MatMultiYearView; + @ViewChild(MatMultiYearView) multiYearView: MatMultiYearView; /** * The current active date. This determines which time period is shown and which date is diff --git a/src/material/datepicker/datepicker-toggle.ts b/src/material/datepicker/datepicker-toggle.ts index d2d483a329b8..b02e521c1895 100644 --- a/src/material/datepicker/datepicker-toggle.ts +++ b/src/material/datepicker/datepicker-toggle.ts @@ -81,10 +81,10 @@ export class MatDatepickerToggle implements AfterContentInit, OnChanges, OnDe @Input() disableRipple: boolean; /** Custom icon set by the consumer. */ - @ContentChild(MatDatepickerToggleIcon, {static: false}) _customIcon: MatDatepickerToggleIcon; + @ContentChild(MatDatepickerToggleIcon) _customIcon: MatDatepickerToggleIcon; /** Underlying button element. */ - @ViewChild('button', {static: false}) _button: MatButton; + @ViewChild('button') _button: MatButton; constructor( public _intl: MatDatepickerIntl, diff --git a/src/material/datepicker/datepicker.spec.ts b/src/material/datepicker/datepicker.spec.ts index 771a6e481d22..23784b20251b 100644 --- a/src/material/datepicker/datepicker.spec.ts +++ b/src/material/datepicker/datepicker.spec.ts @@ -1727,8 +1727,8 @@ class StandardDatepicker { touch = false; disabled = false; date: Date | null = new Date(2020, JAN, 1); - @ViewChild('d', {static: false}) datepicker: MatDatepicker; - @ViewChild(MatDatepickerInput, {static: false}) datepickerInput: MatDatepickerInput; + @ViewChild('d') datepicker: MatDatepicker; + @ViewChild(MatDatepickerInput) datepickerInput: MatDatepickerInput; } @@ -1744,7 +1744,7 @@ class MultiInputDatepicker {} template: ``, }) class NoInputDatepicker { - @ViewChild('d', {static: false}) datepicker: MatDatepicker; + @ViewChild('d') datepicker: MatDatepicker; } @@ -1757,7 +1757,7 @@ class NoInputDatepicker { class DatepickerWithStartAt { date = new Date(2020, JAN, 1); startDate = new Date(2010, JAN, 1); - @ViewChild('d', {static: false}) datepicker: MatDatepicker; + @ViewChild('d') datepicker: MatDatepicker; } @@ -1769,7 +1769,7 @@ class DatepickerWithStartAt { }) class DatepickerWithStartViewYear { date = new Date(2020, JAN, 1); - @ViewChild('d', {static: false}) datepicker: MatDatepicker; + @ViewChild('d') datepicker: MatDatepicker; onYearSelection() {} } @@ -1784,7 +1784,7 @@ class DatepickerWithStartViewYear { }) class DatepickerWithStartViewMultiYear { date = new Date(2020, JAN, 1); - @ViewChild('d', {static: false}) datepicker: MatDatepicker; + @ViewChild('d') datepicker: MatDatepicker; onMultiYearSelection() {} } @@ -1798,8 +1798,8 @@ class DatepickerWithStartViewMultiYear { }) class DatepickerWithNgModel { selected: Date | null = null; - @ViewChild('d', {static: false}) datepicker: MatDatepicker; - @ViewChild(MatDatepickerInput, {static: false}) datepickerInput: MatDatepickerInput; + @ViewChild('d') datepicker: MatDatepicker; + @ViewChild(MatDatepickerInput) datepickerInput: MatDatepickerInput; } @@ -1812,9 +1812,9 @@ class DatepickerWithNgModel { }) class DatepickerWithFormControl { formControl = new FormControl(); - @ViewChild('d', {static: false}) datepicker: MatDatepicker; - @ViewChild(MatDatepickerInput, {static: false}) datepickerInput: MatDatepickerInput; - @ViewChild(MatDatepickerToggle, {static: false}) datepickerToggle: MatDatepickerToggle; + @ViewChild('d') datepicker: MatDatepicker; + @ViewChild(MatDatepickerInput) datepickerInput: MatDatepickerInput; + @ViewChild(MatDatepickerToggle) datepickerToggle: MatDatepickerToggle; } @@ -1826,8 +1826,8 @@ class DatepickerWithFormControl { `, }) class DatepickerWithToggle { - @ViewChild('d', {static: false}) datepicker: MatDatepicker; - @ViewChild(MatDatepickerInput, {static: false}) input: MatDatepickerInput; + @ViewChild('d') datepicker: MatDatepicker; + @ViewChild(MatDatepickerInput) input: MatDatepickerInput; touchUI = true; } @@ -1853,9 +1853,9 @@ class DatepickerWithCustomIcon {} `, }) class FormFieldDatepicker { - @ViewChild('d', {static: false}) datepicker: MatDatepicker; - @ViewChild(MatDatepickerInput, {static: false}) datepickerInput: MatDatepickerInput; - @ViewChild(MatFormField, {static: false}) formField: MatFormField; + @ViewChild('d') datepicker: MatDatepicker; + @ViewChild(MatDatepickerInput) datepickerInput: MatDatepickerInput; + @ViewChild(MatFormField) formField: MatFormField; } @@ -1867,8 +1867,8 @@ class FormFieldDatepicker { `, }) class DatepickerWithMinAndMaxValidation { - @ViewChild('d', {static: false}) datepicker: MatDatepicker; - @ViewChild(NgModel, {static: false}) model: NgModel; + @ViewChild('d') datepicker: MatDatepicker; + @ViewChild(NgModel) model: NgModel; date: Date | null; minDate = new Date(2010, JAN, 1); maxDate = new Date(2020, JAN, 1); @@ -1883,7 +1883,7 @@ class DatepickerWithMinAndMaxValidation { `, }) class DatepickerWithFilterAndValidation { - @ViewChild('d', {static: false}) datepicker: MatDatepicker; + @ViewChild('d') datepicker: MatDatepicker; date: Date; filter = (date: Date) => date.getDate() != 1; } @@ -1897,7 +1897,7 @@ class DatepickerWithFilterAndValidation { ` }) class DatepickerWithChangeAndInputEvents { - @ViewChild('d', {static: false}) datepicker: MatDatepicker; + @ViewChild('d') datepicker: MatDatepicker; onChange() {} @@ -1917,8 +1917,8 @@ class DatepickerWithChangeAndInputEvents { }) class DatepickerWithi18n { date: Date | null = new Date(2010, JAN, 1); - @ViewChild('d', {static: false}) datepicker: MatDatepicker; - @ViewChild(MatDatepickerInput, {static: false}) datepickerInput: MatDatepickerInput; + @ViewChild('d') datepicker: MatDatepicker; + @ViewChild(MatDatepickerInput) datepickerInput: MatDatepickerInput; } @@ -1933,8 +1933,8 @@ class DatepickerWithISOStrings { min = new Date(2017, JAN, 1).toISOString(); max = new Date (2017, DEC, 31).toISOString(); startAt = new Date(2017, JUL, 1).toISOString(); - @ViewChild('d', {static: false}) datepicker: MatDatepicker; - @ViewChild(MatDatepickerInput, {static: false}) datepickerInput: MatDatepickerInput; + @ViewChild('d') datepicker: MatDatepicker; + @ViewChild(MatDatepickerInput) datepickerInput: MatDatepickerInput; } @@ -1948,7 +1948,7 @@ class DatepickerWithEvents { selected: Date | null = null; openedSpy = jasmine.createSpy('opened spy'); closedSpy = jasmine.createSpy('closed spy'); - @ViewChild('d', {static: false}) datepicker: MatDatepicker; + @ViewChild('d') datepicker: MatDatepicker; } @@ -1959,7 +1959,7 @@ class DatepickerWithEvents { `, }) class DatepickerOpeningOnFocus { - @ViewChild(MatDatepicker, {static: false}) datepicker: MatDatepicker; + @ViewChild(MatDatepicker) datepicker: MatDatepicker; } @@ -1970,7 +1970,7 @@ class DatepickerOpeningOnFocus { `, }) class DatepickerWithCustomHeader { - @ViewChild('ch', {static: false}) datepicker: MatDatepicker; + @ViewChild('ch') datepicker: MatDatepicker; customHeaderForDatePicker = CustomHeaderForDatepicker; } @@ -1989,8 +1989,8 @@ class CustomHeaderForDatepicker {} `, }) class DelayedDatepicker { - @ViewChild('d', {static: false}) datepicker: MatDatepicker; - @ViewChild(MatDatepickerInput, {static: false}) datepickerInput: MatDatepickerInput; + @ViewChild('d') datepicker: MatDatepicker; + @ViewChild(MatDatepickerInput) datepickerInput: MatDatepickerInput; date: Date | null; assignedDatepicker: MatDatepicker; } diff --git a/src/material/datepicker/datepicker.ts b/src/material/datepicker/datepicker.ts index 25ee51eb6f28..f675edf4cce3 100644 --- a/src/material/datepicker/datepicker.ts +++ b/src/material/datepicker/datepicker.ts @@ -109,7 +109,7 @@ export class MatDatepickerContent extends _MatDatepickerContentMixinBase implements AfterViewInit, CanColor { /** Reference to the internal calendar component. */ - @ViewChild(MatCalendar, {static: false}) _calendar: MatCalendar; + @ViewChild(MatCalendar) _calendar: MatCalendar; /** Reference to the datepicker that created the overlay. */ datepicker: MatDatepicker; diff --git a/src/material/datepicker/month-view.ts b/src/material/datepicker/month-view.ts index b0c190977c56..a7deff55a027 100644 --- a/src/material/datepicker/month-view.ts +++ b/src/material/datepicker/month-view.ts @@ -110,7 +110,7 @@ export class MatMonthView implements AfterContentInit { @Output() readonly activeDateChange: EventEmitter = new EventEmitter(); /** The body of calendar table */ - @ViewChild(MatCalendarBody, {static: false}) _matCalendarBody: MatCalendarBody; + @ViewChild(MatCalendarBody) _matCalendarBody: MatCalendarBody; /** The label for this month (e.g. "January 2017"). */ _monthLabel: string; diff --git a/src/material/datepicker/multi-year-view.spec.ts b/src/material/datepicker/multi-year-view.spec.ts index 93fde73d32ab..de9d7cf22834 100644 --- a/src/material/datepicker/multi-year-view.spec.ts +++ b/src/material/datepicker/multi-year-view.spec.ts @@ -340,7 +340,7 @@ class StandardMultiYearView { selected = new Date(2020, JAN, 1); selectedYear: Date; - @ViewChild(MatMultiYearView, {static: false}) multiYearView: MatMultiYearView; + @ViewChild(MatMultiYearView) multiYearView: MatMultiYearView; } @Component({ diff --git a/src/material/datepicker/multi-year-view.ts b/src/material/datepicker/multi-year-view.ts index 443c50ab5994..7e48426624ee 100644 --- a/src/material/datepicker/multi-year-view.ts +++ b/src/material/datepicker/multi-year-view.ts @@ -106,7 +106,7 @@ export class MatMultiYearView implements AfterContentInit { @Output() readonly activeDateChange: EventEmitter = new EventEmitter(); /** The body of calendar table */ - @ViewChild(MatCalendarBody, {static: false}) _matCalendarBody: MatCalendarBody; + @ViewChild(MatCalendarBody) _matCalendarBody: MatCalendarBody; /** Grid of calendar cells representing the currently displayed years. */ _years: MatCalendarCell[][]; diff --git a/src/material/datepicker/year-view.spec.ts b/src/material/datepicker/year-view.spec.ts index 0ec6e5d6f222..c319c7cac1fe 100644 --- a/src/material/datepicker/year-view.spec.ts +++ b/src/material/datepicker/year-view.spec.ts @@ -327,7 +327,7 @@ class StandardYearView { selected = new Date(2017, MAR, 10); selectedMonth: Date; - @ViewChild(MatYearView, {static: false}) yearView: MatYearView; + @ViewChild(MatYearView) yearView: MatYearView; } diff --git a/src/material/datepicker/year-view.ts b/src/material/datepicker/year-view.ts index bd70efc002cd..54f42dee53c4 100644 --- a/src/material/datepicker/year-view.ts +++ b/src/material/datepicker/year-view.ts @@ -101,7 +101,7 @@ export class MatYearView implements AfterContentInit { @Output() readonly activeDateChange: EventEmitter = new EventEmitter(); /** The body of calendar table */ - @ViewChild(MatCalendarBody, {static: false}) _matCalendarBody: MatCalendarBody; + @ViewChild(MatCalendarBody) _matCalendarBody: MatCalendarBody; /** Grid of calendar cells representing the months of the year. */ _months: MatCalendarCell[][]; diff --git a/src/material/dialog/dialog.spec.ts b/src/material/dialog/dialog.spec.ts index d77df7e2c7d4..8393f1dfe00f 100644 --- a/src/material/dialog/dialog.spec.ts +++ b/src/material/dialog/dialog.spec.ts @@ -1554,9 +1554,7 @@ class ComponentWithOnPushViewContainer { template: ``, }) class ComponentWithChildViewContainer { - @ViewChild(DirectiveWithViewContainer, { - static: false - }) childWithViewContainer: DirectiveWithViewContainer; + @ViewChild(DirectiveWithViewContainer) childWithViewContainer: DirectiveWithViewContainer; get childViewContainer() { return this.childWithViewContainer.viewContainerRef; @@ -1572,7 +1570,7 @@ class ComponentWithTemplateRef { localValue: string; dialogRef: MatDialogRef; - @ViewChild(TemplateRef, {static: false}) templateRef: TemplateRef; + @ViewChild(TemplateRef) templateRef: TemplateRef; setDialogRef(dialogRef: MatDialogRef): string { this.dialogRef = dialogRef; @@ -1625,9 +1623,7 @@ class ContentElementDialog {} ` }) class ComponentWithContentElementTemplateRef { - @ViewChild(TemplateRef, { - static: false - }) templateRef: TemplateRef; + @ViewChild(TemplateRef) templateRef: TemplateRef; } @Component({ diff --git a/src/material/dialog/testing/shared.spec.ts b/src/material/dialog/testing/shared.spec.ts index 1eb9b4b88bc6..7bfb7f41e187 100644 --- a/src/material/dialog/testing/shared.spec.ts +++ b/src/material/dialog/testing/shared.spec.ts @@ -125,7 +125,7 @@ export function runHarnessTests( ` }) class DialogHarnessTest { - @ViewChild(TemplateRef, {static: false}) dialogTmpl: TemplateRef; + @ViewChild(TemplateRef) dialogTmpl: TemplateRef; constructor(readonly dialog: MatDialog) {} diff --git a/src/material/expansion/accordion.spec.ts b/src/material/expansion/accordion.spec.ts index 82bd5b5645e3..c7b9ae042666 100644 --- a/src/material/expansion/accordion.spec.ts +++ b/src/material/expansion/accordion.spec.ts @@ -295,7 +295,7 @@ describe('MatAccordion', () => { `}) class SetOfItems { - @ViewChild(MatAccordion, {static: false}) accordion: MatAccordion; + @ViewChild(MatAccordion) accordion: MatAccordion; @ViewChildren(MatExpansionPanel) panels: QueryList; @ViewChildren(MatExpansionPanelHeader) headers: QueryList; @@ -313,8 +313,8 @@ class SetOfItems { `}) class NestedPanel { - @ViewChild('outerPanel', {static: false}) outerPanel: MatExpansionPanel; - @ViewChild('innerPanel', {static: false}) innerPanel: MatExpansionPanel; + @ViewChild('outerPanel') outerPanel: MatExpansionPanel; + @ViewChild('innerPanel') innerPanel: MatExpansionPanel; } @Component({template: ` diff --git a/src/material/expansion/expansion-panel.ts b/src/material/expansion/expansion-panel.ts index b26f0a6f26ff..3acbb967acf0 100644 --- a/src/material/expansion/expansion-panel.ts +++ b/src/material/expansion/expansion-panel.ts @@ -135,10 +135,10 @@ export class MatExpansionPanel extends CdkAccordionItem implements AfterContentI accordion: MatAccordionBase; /** Content that will be rendered lazily. */ - @ContentChild(MatExpansionPanelContent, {static: false}) _lazyContent: MatExpansionPanelContent; + @ContentChild(MatExpansionPanelContent) _lazyContent: MatExpansionPanelContent; /** Element containing the panel's user-provided content. */ - @ViewChild('body', {static: false}) _body: ElementRef; + @ViewChild('body') _body: ElementRef; /** Portal holding the user's content. */ _portal: TemplatePortal; diff --git a/src/material/expansion/expansion.spec.ts b/src/material/expansion/expansion.spec.ts index 1d4e501860ab..0d1e2b5300e4 100644 --- a/src/material/expansion/expansion.spec.ts +++ b/src/material/expansion/expansion.spec.ts @@ -425,7 +425,7 @@ class PanelWithContent { disabled = false; openCallback = jasmine.createSpy('openCallback'); closeCallback = jasmine.createSpy('closeCallback'); - @ViewChild(MatExpansionPanel, {static: false}) panel: MatExpansionPanel; + @ViewChild(MatExpansionPanel) panel: MatExpansionPanel; } @Component({ @@ -438,7 +438,7 @@ class PanelWithContent { }) class PanelWithContentInNgIf { expansionShown = true; - @ViewChild(MatExpansionPanel, {static: false}) panel: MatExpansionPanel; + @ViewChild(MatExpansionPanel) panel: MatExpansionPanel; } @Component({ diff --git a/src/material/form-field/form-field.ts b/src/material/form-field/form-field.ts index 8bf83c8d8a7c..ab385585d75a 100644 --- a/src/material/form-field/form-field.ts +++ b/src/material/form-field/form-field.ts @@ -245,13 +245,13 @@ export class MatFormField extends _MatFormFieldMixinBase * @deprecated * @breaking-change 8.0.0 */ - @ViewChild('underline', {static: false}) underlineRef: ElementRef; + @ViewChild('underline') underlineRef: ElementRef; @ViewChild('connectionContainer', {static: true}) _connectionContainerRef: ElementRef; - @ViewChild('inputContainer', {static: false}) _inputContainerRef: ElementRef; - @ViewChild('label', {static: false}) private _label: ElementRef; + @ViewChild('inputContainer') _inputContainerRef: ElementRef; + @ViewChild('label') private _label: ElementRef; - @ContentChild(MatFormFieldControl, {static: false}) _controlNonStatic: MatFormFieldControl; + @ContentChild(MatFormFieldControl) _controlNonStatic: MatFormFieldControl; @ContentChild(MatFormFieldControl, {static: true}) _controlStatic: MatFormFieldControl; get _control() { // TODO(crisbeto): we need this hacky workaround in order to support both Ivy @@ -263,13 +263,13 @@ export class MatFormField extends _MatFormFieldMixinBase } private _explicitFormFieldControl: MatFormFieldControl; - @ContentChild(MatLabel, {static: false}) _labelChildNonStatic: MatLabel; + @ContentChild(MatLabel) _labelChildNonStatic: MatLabel; @ContentChild(MatLabel, {static: true}) _labelChildStatic: MatLabel; get _labelChild() { return this._labelChildNonStatic || this._labelChildStatic; } - @ContentChild(MatPlaceholder, {static: false}) _placeholderChild: MatPlaceholder; + @ContentChild(MatPlaceholder) _placeholderChild: MatPlaceholder; @ContentChildren(MatError, {descendants: true}) _errorChildren: QueryList; @ContentChildren(MatHint, {descendants: true}) _hintChildren: QueryList; @ContentChildren(MatPrefix, {descendants: true}) _prefixChildren: QueryList; diff --git a/src/material/grid-list/grid-list.spec.ts b/src/material/grid-list/grid-list.spec.ts index 97484c46c09c..7e909de992e4 100644 --- a/src/material/grid-list/grid-list.spec.ts +++ b/src/material/grid-list/grid-list.spec.ts @@ -616,7 +616,7 @@ class GridListWithTooWideColspan { } @Component({template: ''}) class GridListWithDynamicCols { - @ViewChild(MatGridList, {static: false}) gridList: MatGridList; + @ViewChild(MatGridList) gridList: MatGridList; cols = 2; } diff --git a/src/material/input/input.spec.ts b/src/material/input/input.spec.ts index 0f4f29d630dc..e9b9dcf996ab 100644 --- a/src/material/input/input.spec.ts +++ b/src/material/input/input.spec.ts @@ -1869,7 +1869,7 @@ class MatInputMissingMatInputTestController {} ` }) class MatInputWithFormErrorMessages { - @ViewChild('form', {static: false}) form: NgForm; + @ViewChild('form') form: NgForm; formControl = new FormControl('', Validators.required); renderError = true; } @@ -1911,7 +1911,7 @@ class MatInputWithCustomErrorStateMatcher { ` }) class MatInputWithFormGroupErrorMessages { - @ViewChild(FormGroupDirective, {static: false}) formGroupDirective: FormGroupDirective; + @ViewChild(FormGroupDirective) formGroupDirective: FormGroupDirective; formGroup = new FormGroup({ name: new FormControl('', Validators.required) }); @@ -1992,7 +1992,7 @@ class MatInputWithLabelAndPlaceholder { ` }) class MatInputWithAppearance { - @ViewChild(MatFormField, {static: false}) formField: MatFormField; + @ViewChild(MatFormField) formField: MatFormField; appearance: MatFormFieldAppearance; } @@ -2006,7 +2006,7 @@ class MatInputWithAppearance { ` }) class MatInputWithAppearanceAndLabel { - @ViewChild(MatFormField, {static: false}) formField: MatFormField; + @ViewChild(MatFormField) formField: MatFormField; appearance: MatFormFieldAppearance; showPrefix: boolean; labelContent = 'Label'; @@ -2042,7 +2042,7 @@ class MatInputWithOutlineInsideInvisibleElement {} encapsulation: ViewEncapsulation.ShadowDom }) class MatInputWithOutlineAppearanceInShadowDOM { - @ViewChild('formField', {read: ElementRef, static: false}) formField: ElementRef; + @ViewChild('formField', {read: ElementRef}) formField: ElementRef; } @@ -2063,7 +2063,7 @@ const textareaStyleReset = ` }) class AutosizeTextareaWithLongPlaceholder { placeholder = 'Long Long Long Long Long Long Long Long Placeholder'; - @ViewChild(MatTextareaAutosize, {static: false}) autosize: MatTextareaAutosize; + @ViewChild(MatTextareaAutosize) autosize: MatTextareaAutosize; } @Component({ diff --git a/src/material/list/list.ts b/src/material/list/list.ts index 0b34f00b6121..f0bc5982940d 100644 --- a/src/material/list/list.ts +++ b/src/material/list/list.ts @@ -172,8 +172,8 @@ export class MatListItem extends _MatListItemMixinBase implements AfterContentIn private _destroyed = new Subject(); @ContentChildren(MatLine, {descendants: true}) _lines: QueryList; - @ContentChild(MatListAvatarCssMatStyler, {static: false}) _avatar: MatListAvatarCssMatStyler; - @ContentChild(MatListIconCssMatStyler, {static: false}) _icon: MatListIconCssMatStyler; + @ContentChild(MatListAvatarCssMatStyler) _avatar: MatListAvatarCssMatStyler; + @ContentChild(MatListIconCssMatStyler) _icon: MatListIconCssMatStyler; constructor(private _element: ElementRef, _changeDetectorRef: ChangeDetectorRef, diff --git a/src/material/list/selection-list.ts b/src/material/list/selection-list.ts index c4ae31e451a1..e1101d0bcee7 100644 --- a/src/material/list/selection-list.ts +++ b/src/material/list/selection-list.ts @@ -121,12 +121,12 @@ export class MatListOption extends _MatListOptionMixinBase private _disabled = false; private _hasFocus = false; - @ContentChild(MatListAvatarCssMatStyler, {static: false}) _avatar: MatListAvatarCssMatStyler; - @ContentChild(MatListIconCssMatStyler, {static: false}) _icon: MatListIconCssMatStyler; + @ContentChild(MatListAvatarCssMatStyler) _avatar: MatListAvatarCssMatStyler; + @ContentChild(MatListIconCssMatStyler) _icon: MatListIconCssMatStyler; @ContentChildren(MatLine) _lines: QueryList; /** DOM element containing the item's text. */ - @ViewChild('text', {static: false}) _text: ElementRef; + @ViewChild('text') _text: ElementRef; /** Whether the label should appear before or after the checkbox. Defaults to 'after' */ @Input() checkboxPosition: 'before' | 'after' = 'after'; diff --git a/src/material/menu/menu.spec.ts b/src/material/menu/menu.spec.ts index f338e672392d..b4771f42097f 100644 --- a/src/material/menu/menu.spec.ts +++ b/src/material/menu/menu.spec.ts @@ -2121,9 +2121,9 @@ describe('MatMenu default overrides', () => { ` }) class SimpleMenu { - @ViewChild(MatMenuTrigger, {static: false}) trigger: MatMenuTrigger; - @ViewChild('triggerEl', {static: false}) triggerEl: ElementRef; - @ViewChild(MatMenu, {static: false}) menu: MatMenu; + @ViewChild(MatMenuTrigger) trigger: MatMenuTrigger; + @ViewChild('triggerEl') triggerEl: ElementRef; + @ViewChild(MatMenu) menu: MatMenu; @ViewChildren(MatMenuItem) items: QueryList; extraItems: string[] = []; closeCallback = jasmine.createSpy('menu closed callback'); @@ -2141,8 +2141,8 @@ class SimpleMenu { ` }) class PositionedMenu { - @ViewChild(MatMenuTrigger, {static: false}) trigger: MatMenuTrigger; - @ViewChild('triggerEl', {static: false}) triggerEl: ElementRef; + @ViewChild(MatMenuTrigger) trigger: MatMenuTrigger; + @ViewChild('triggerEl') triggerEl: ElementRef; xPosition: MenuPositionX = 'before'; yPosition: MenuPositionY = 'above'; } @@ -2161,8 +2161,8 @@ interface TestableMenu { }) class OverlapMenu implements TestableMenu { @Input() overlapTrigger: boolean; - @ViewChild(MatMenuTrigger, {static: false}) trigger: MatMenuTrigger; - @ViewChild('triggerEl', {static: false}) triggerEl: ElementRef; + @ViewChild(MatMenuTrigger) trigger: MatMenuTrigger; + @ViewChild('triggerEl') triggerEl: ElementRef; } @Component({ @@ -2182,7 +2182,7 @@ class CustomMenuPanel implements MatMenuPanel { overlapTrigger = true; parentMenu: MatMenuPanel; - @ViewChild(TemplateRef, {static: false}) templateRef: TemplateRef; + @ViewChild(TemplateRef) templateRef: TemplateRef; @Output() close = new EventEmitter(); focusFirstItem = () => {}; resetActiveItem = () => {}; @@ -2198,7 +2198,7 @@ class CustomMenuPanel implements MatMenuPanel { ` }) class CustomMenu { - @ViewChild(MatMenuTrigger, {static: false}) trigger: MatMenuTrigger; + @ViewChild(MatMenuTrigger) trigger: MatMenuTrigger; } @@ -2249,22 +2249,22 @@ class CustomMenu { ` }) class NestedMenu { - @ViewChild('root', {static: false}) rootMenu: MatMenu; - @ViewChild('rootTrigger', {static: false}) rootTrigger: MatMenuTrigger; - @ViewChild('rootTriggerEl', {static: false}) rootTriggerEl: ElementRef; - @ViewChild('alternateTrigger', {static: false}) alternateTrigger: MatMenuTrigger; + @ViewChild('root') rootMenu: MatMenu; + @ViewChild('rootTrigger') rootTrigger: MatMenuTrigger; + @ViewChild('rootTriggerEl') rootTriggerEl: ElementRef; + @ViewChild('alternateTrigger') alternateTrigger: MatMenuTrigger; readonly rootCloseCallback = jasmine.createSpy('root menu closed callback'); - @ViewChild('levelOne', {static: false}) levelOneMenu: MatMenu; - @ViewChild('levelOneTrigger', {static: false}) levelOneTrigger: MatMenuTrigger; + @ViewChild('levelOne') levelOneMenu: MatMenu; + @ViewChild('levelOneTrigger') levelOneTrigger: MatMenuTrigger; readonly levelOneCloseCallback = jasmine.createSpy('level one menu closed callback'); - @ViewChild('levelTwo', {static: false}) levelTwoMenu: MatMenu; - @ViewChild('levelTwoTrigger', {static: false}) levelTwoTrigger: MatMenuTrigger; + @ViewChild('levelTwo') levelTwoMenu: MatMenu; + @ViewChild('levelTwoTrigger') levelTwoTrigger: MatMenuTrigger; readonly levelTwoCloseCallback = jasmine.createSpy('level one menu closed callback'); - @ViewChild('lazy', {static: false}) lazyMenu: MatMenu; - @ViewChild('lazyTrigger', {static: false}) lazyTrigger: MatMenuTrigger; + @ViewChild('lazy') lazyMenu: MatMenu; + @ViewChild('lazyTrigger') lazyTrigger: MatMenuTrigger; showLazy = false; } @@ -2284,8 +2284,8 @@ class NestedMenu { ` }) class NestedMenuCustomElevation { - @ViewChild('rootTrigger', {static: false}) rootTrigger: MatMenuTrigger; - @ViewChild('levelOneTrigger', {static: false}) levelOneTrigger: MatMenuTrigger; + @ViewChild('rootTrigger') rootTrigger: MatMenuTrigger; + @ViewChild('levelOneTrigger') levelOneTrigger: MatMenuTrigger; } @@ -2307,8 +2307,8 @@ class NestedMenuCustomElevation { ` }) class NestedMenuRepeater { - @ViewChild('rootTriggerEl', {static: false}) rootTriggerEl: ElementRef; - @ViewChild('levelOneTrigger', {static: false}) levelOneTrigger: MatMenuTrigger; + @ViewChild('rootTriggerEl') rootTriggerEl: ElementRef; + @ViewChild('levelOneTrigger') levelOneTrigger: MatMenuTrigger; items = ['one', 'two', 'three']; } @@ -2328,7 +2328,7 @@ class NestedMenuRepeater { ` }) class SubmenuDeclaredInsideParentMenu { - @ViewChild('rootTriggerEl', {static: false}) rootTriggerEl: ElementRef; + @ViewChild('rootTriggerEl') rootTriggerEl: ElementRef; } @@ -2352,8 +2352,8 @@ class FakeIcon {} ` }) class SimpleLazyMenu { - @ViewChild(MatMenuTrigger, {static: false}) trigger: MatMenuTrigger; - @ViewChild('triggerEl', {static: false}) triggerEl: ElementRef; + @ViewChild(MatMenuTrigger) trigger: MatMenuTrigger; + @ViewChild('triggerEl') triggerEl: ElementRef; @ViewChildren(MatMenuItem) items: QueryList; } @@ -2378,8 +2378,8 @@ class SimpleLazyMenu { ` }) class LazyMenuWithContext { - @ViewChild('triggerOne', {static: false}) triggerOne: MatMenuTrigger; - @ViewChild('triggerTwo', {static: false}) triggerTwo: MatMenuTrigger; + @ViewChild('triggerOne') triggerOne: MatMenuTrigger; + @ViewChild('triggerTwo') triggerTwo: MatMenuTrigger; } @@ -2396,9 +2396,9 @@ class LazyMenuWithContext { ` }) class DynamicPanelMenu { - @ViewChild(MatMenuTrigger, {static: false}) trigger: MatMenuTrigger; - @ViewChild('one', {static: false}) firstMenu: MatMenu; - @ViewChild('two', {static: false}) secondMenu: MatMenu; + @ViewChild(MatMenuTrigger) trigger: MatMenuTrigger; + @ViewChild('one') firstMenu: MatMenu; + @ViewChild('two') secondMenu: MatMenu; } @@ -2413,7 +2413,7 @@ class DynamicPanelMenu { ` }) class MenuWithCheckboxItems { - @ViewChild(MatMenuTrigger, {static: false}) trigger: MatMenuTrigger; + @ViewChild(MatMenuTrigger) trigger: MatMenuTrigger; } @@ -2429,8 +2429,8 @@ class MenuWithCheckboxItems { ` }) class SimpleMenuWithRepeater { - @ViewChild(MatMenuTrigger, {static: false}) trigger: MatMenuTrigger; - @ViewChild(MatMenu, {static: false}) menu: MatMenu; + @ViewChild(MatMenuTrigger) trigger: MatMenuTrigger; + @ViewChild(MatMenu) menu: MatMenu; items = [{label: 'Pizza', disabled: false}, {label: 'Pasta', disabled: false}]; } @@ -2453,6 +2453,6 @@ class SimpleMenuWithRepeater { changeDetection: ChangeDetectionStrategy.OnPush, }) class LazyMenuWithOnPush { - @ViewChild('triggerEl', {static: false, read: ElementRef}) rootTrigger: ElementRef; - @ViewChild('menuItem', {static: false, read: ElementRef}) menuItemWithSubmenu: ElementRef; + @ViewChild('triggerEl', {read: ElementRef}) rootTrigger: ElementRef; + @ViewChild('menuItem', {read: ElementRef}) menuItemWithSubmenu: ElementRef; } diff --git a/src/material/menu/menu.ts b/src/material/menu/menu.ts index 4ecb6c2d9779..fed2d4447b71 100644 --- a/src/material/menu/menu.ts +++ b/src/material/menu/menu.ts @@ -158,7 +158,7 @@ export class _MatMenuBase implements AfterContentInit, MatMenuPanel } /** @docs-private */ - @ViewChild(TemplateRef, {static: false}) templateRef: TemplateRef; + @ViewChild(TemplateRef) templateRef: TemplateRef; /** * List of the items inside of a menu. @@ -171,7 +171,7 @@ export class _MatMenuBase implements AfterContentInit, MatMenuPanel * Menu content that will be rendered lazily. * @docs-private */ - @ContentChild(MatMenuContent, {static: false}) lazyContent: MatMenuContent; + @ContentChild(MatMenuContent) lazyContent: MatMenuContent; /** Whether the menu should overlap its trigger. */ @Input() diff --git a/src/material/paginator/paginator.spec.ts b/src/material/paginator/paginator.spec.ts index 6535f24c5b4f..8d2b24110077 100644 --- a/src/material/paginator/paginator.spec.ts +++ b/src/material/paginator/paginator.spec.ts @@ -457,7 +457,7 @@ class MatPaginatorApp { pageEvent = jasmine.createSpy('page event'); color: ThemePalette; - @ViewChild(MatPaginator, {static: false}) paginator: MatPaginator; + @ViewChild(MatPaginator) paginator: MatPaginator; goToLastPage() { this.pageIndex = Math.ceil(this.length / this.pageSize) - 1; @@ -470,7 +470,7 @@ class MatPaginatorApp { `, }) class MatPaginatorWithoutInputsApp { - @ViewChild(MatPaginator, {static: false}) paginator: MatPaginator; + @ViewChild(MatPaginator) paginator: MatPaginator; } @Component({ @@ -479,7 +479,7 @@ class MatPaginatorWithoutInputsApp { `, }) class MatPaginatorWithoutPageSizeApp { - @ViewChild(MatPaginator, {static: false}) paginator: MatPaginator; + @ViewChild(MatPaginator) paginator: MatPaginator; } @Component({ @@ -488,7 +488,7 @@ class MatPaginatorWithoutPageSizeApp { `, }) class MatPaginatorWithoutOptionsApp { - @ViewChild(MatPaginator, {static: false}) paginator: MatPaginator; + @ViewChild(MatPaginator) paginator: MatPaginator; } @Component({ @@ -501,5 +501,5 @@ class MatPaginatorWithoutOptionsApp { ` }) class MatPaginatorWithStringValues { - @ViewChild(MatPaginator, {static: false}) paginator: MatPaginator; + @ViewChild(MatPaginator) paginator: MatPaginator; } diff --git a/src/material/progress-bar/progress-bar.ts b/src/material/progress-bar/progress-bar.ts index 2bcb32a5ac72..bf9603164b06 100644 --- a/src/material/progress-bar/progress-bar.ts +++ b/src/material/progress-bar/progress-bar.ts @@ -147,7 +147,7 @@ export class MatProgressBar extends _MatProgressBarMixinBase implements CanColor set bufferValue(v: number) { this._bufferValue = clamp(v || 0); } private _bufferValue: number = 0; - @ViewChild('primaryValueBar', {static: false}) _primaryValueBar: ElementRef; + @ViewChild('primaryValueBar') _primaryValueBar: ElementRef; /** * Event emitted when animation of the primary progress bar completes. This event will not diff --git a/src/material/progress-spinner/progress-spinner.spec.ts b/src/material/progress-spinner/progress-spinner.spec.ts index f6561ca4a0fe..687f4b098316 100644 --- a/src/material/progress-spinner/progress-spinner.spec.ts +++ b/src/material/progress-spinner/progress-spinner.spec.ts @@ -488,7 +488,7 @@ class IndeterminateSpinnerInShadowDom { encapsulation: ViewEncapsulation.ShadowDom, }) class IndeterminateSpinnerInShadowDomWithNgIf { - @ViewChild(MatProgressSpinner, {read: ElementRef, static: false}) + @ViewChild(MatProgressSpinner, {read: ElementRef}) spinner: ElementRef; diameter: number; diff --git a/src/material/radio/radio.spec.ts b/src/material/radio/radio.spec.ts index 4f8e59d4cb93..c9c8421415a7 100644 --- a/src/material/radio/radio.spec.ts +++ b/src/material/radio/radio.spec.ts @@ -938,7 +938,7 @@ class RadioGroupWithNgModel { template: `One` }) class DisableableRadioButton { - @ViewChild(MatRadioButton, {static: false}) matRadioButton: MatRadioButton; + @ViewChild(MatRadioButton) matRadioButton: MatRadioButton; set disabled(value: boolean) { this.matRadioButton.disabled = value; diff --git a/src/material/radio/radio.ts b/src/material/radio/radio.ts index d3101881f4b0..ba90f4c3255d 100644 --- a/src/material/radio/radio.ts +++ b/src/material/radio/radio.ts @@ -489,7 +489,7 @@ export class MatRadioButton extends _MatRadioButtonMixinBase private _removeUniqueSelectionListener: () => void = () => {}; /** The native `` element */ - @ViewChild('input', {static: false}) _inputElement: ElementRef; + @ViewChild('input') _inputElement: ElementRef; constructor(@Optional() radioGroup: MatRadioGroup, elementRef: ElementRef, diff --git a/src/material/schematics/ng-generate/table/files/__path__/__name@dasherize@if-flat__/__name@dasherize__.component.ts.template b/src/material/schematics/ng-generate/table/files/__path__/__name@dasherize@if-flat__/__name@dasherize__.component.ts.template index da3c22a45fb9..858530da3050 100644 --- a/src/material/schematics/ng-generate/table/files/__path__/__name@dasherize@if-flat__/__name@dasherize__.component.ts.template +++ b/src/material/schematics/ng-generate/table/files/__path__/__name@dasherize@if-flat__/__name@dasherize__.component.ts.template @@ -18,9 +18,9 @@ import { <%= classify(name) %>DataSource, <%= classify(name) %>Item } from './<% changeDetection: ChangeDetectionStrategy.<%= changeDetection %><% } %> }) export class <%= classify(name) %>Component implements AfterViewInit, OnInit { - @ViewChild(MatPaginator, {static: false}) paginator: MatPaginator; - @ViewChild(MatSort, {static: false}) sort: MatSort; - @ViewChild(MatTable, {static: false}) table: MatTable<<%= classify(name) %>Item>; + @ViewChild(MatPaginator) paginator: MatPaginator; + @ViewChild(MatSort) sort: MatSort; + @ViewChild(MatTable) table: MatTable<<%= classify(name) %>Item>; dataSource: <%= classify(name) %>DataSource; /** Columns displayed in the table. Columns IDs can be added, removed, or reordered. */ diff --git a/src/material/select/select.spec.ts b/src/material/select/select.spec.ts index 9c77f921b41c..8769a534f6a9 100644 --- a/src/material/select/select.spec.ts +++ b/src/material/select/select.spec.ts @@ -4436,7 +4436,7 @@ class NgModelSelect { ]; isDisabled: boolean; - @ViewChild(MatSelect, {static: false}) select: MatSelect; + @ViewChild(MatSelect) select: MatSelect; @ViewChildren(MatOption) options: QueryList; } @@ -4482,7 +4482,7 @@ class NgIfSelect { ]; control = new FormControl('pizza-1'); - @ViewChild(MatSelect, {static: false}) select: MatSelect; + @ViewChild(MatSelect) select: MatSelect; } @Component({ @@ -4526,7 +4526,7 @@ class SelectInitWithoutOptions { foods: any[]; control = new FormControl('pizza-1'); - @ViewChild(MatSelect, {static: false}) select: MatSelect; + @ViewChild(MatSelect) select: MatSelect; @ViewChildren(MatOption) options: QueryList; addOptions() { @@ -4548,7 +4548,7 @@ class SelectInitWithoutOptions { }] }) class CustomSelectAccessor implements ControlValueAccessor { - @ViewChild(MatSelect, {static: false}) select: MatSelect; + @ViewChild(MatSelect) select: MatSelect; writeValue: (value?: any) => void = () => {}; registerOnChange: (changeFn?: (value: any) => void) => void = () => {}; @@ -4657,7 +4657,7 @@ class FloatLabelSelect { { value: 'tacos-2', viewValue: 'Tacos'} ]; - @ViewChild(MatSelect, {static: false}) select: MatSelect; + @ViewChild(MatSelect) select: MatSelect; } @Component({ @@ -4686,7 +4686,7 @@ class MultiSelect { ]; control = new FormControl(); - @ViewChild(MatSelect, {static: false}) select: MatSelect; + @ViewChild(MatSelect) select: MatSelect; @ViewChildren(MatOption) options: QueryList; sortComparator: (a: MatOption, b: MatOption, options: MatOption[]) => number; } @@ -4746,7 +4746,7 @@ class BasicSelectNoPlaceholder { } ` }) class BasicSelectWithTheming { - @ViewChild(MatSelect, {static: false}) select: MatSelect; + @ViewChild(MatSelect) select: MatSelect; theme: string; } @@ -4774,7 +4774,7 @@ class ResetValuesSelect { ]; control = new FormControl(); - @ViewChild(MatSelect, {static: false}) select: MatSelect; + @ViewChild(MatSelect) select: MatSelect; } @Component({ @@ -4850,7 +4850,7 @@ class SelectWithGroups { } ]; - @ViewChild(MatSelect, {static: false}) select: MatSelect; + @ViewChild(MatSelect) select: MatSelect; @ViewChildren(MatOption) options: QueryList; } @@ -4930,8 +4930,8 @@ class InvalidSelectInForm { ` }) class SelectInsideFormGroup { - @ViewChild(FormGroupDirective, {static: false}) formGroupDirective: FormGroupDirective; - @ViewChild(MatSelect, {static: false}) select: MatSelect; + @ViewChild(FormGroupDirective) formGroupDirective: FormGroupDirective; + @ViewChild(MatSelect) select: MatSelect; options = [ {value: 'steak-0', viewValue: 'Steak'}, {value: 'pizza-1', viewValue: 'Pizza'}, @@ -4961,7 +4961,7 @@ class BasicSelectWithoutForms { { value: 'sandwich-2', viewValue: 'Sandwich' }, ]; - @ViewChild(MatSelect, {static: false}) select: MatSelect; + @ViewChild(MatSelect) select: MatSelect; } @Component({ @@ -4982,7 +4982,7 @@ class BasicSelectWithoutFormsPreselected { { value: 'pizza-1', viewValue: 'Pizza' }, ]; - @ViewChild(MatSelect, {static: false}) select: MatSelect; + @ViewChild(MatSelect) select: MatSelect; } @Component({ @@ -5004,7 +5004,7 @@ class BasicSelectWithoutFormsMultiple { { value: 'sandwich-2', viewValue: 'Sandwich' }, ]; - @ViewChild(MatSelect, {static: false}) select: MatSelect; + @ViewChild(MatSelect) select: MatSelect; } @Component({ @@ -5050,7 +5050,7 @@ class NgModelCompareWithSelect { selectedFood: {value: string, viewValue: string} = { value: 'pizza-1', viewValue: 'Pizza' }; comparator: ((f1: any, f2: any) => boolean)|null = this.compareByValue; - @ViewChild(MatSelect, {static: false}) select: MatSelect; + @ViewChild(MatSelect) select: MatSelect; @ViewChildren(MatOption) options: QueryList; useCompareByValue() { this.comparator = this.compareByValue; } @@ -5078,7 +5078,7 @@ class NgModelCompareWithSelect { ` }) class CustomErrorBehaviorSelect { - @ViewChild(MatSelect, {static: false}) select: MatSelect; + @ViewChild(MatSelect) select: MatSelect; control = new FormControl(); foods: any[] = [ { value: 'steak-0', viewValue: 'Steak' }, @@ -5107,7 +5107,7 @@ class SingleSelectWithPreselectedArrayValues { selectedFoods = this.foods[1].value; - @ViewChild(MatSelect, {static: false}) select: MatSelect; + @ViewChild(MatSelect) select: MatSelect; @ViewChildren(MatOption) options: QueryList; } @@ -5136,7 +5136,7 @@ class SelectWithoutOptionCentering { ]; control = new FormControl('pizza-1'); - @ViewChild(MatSelect, {static: false}) select: MatSelect; + @ViewChild(MatSelect) select: MatSelect; @ViewChildren(MatOption) options: QueryList; } diff --git a/src/material/select/select.ts b/src/material/select/select.ts index 14db7386ad66..eb2db981a66e 100644 --- a/src/material/select/select.ts +++ b/src/material/select/select.ts @@ -332,13 +332,13 @@ export class MatSelect extends _MatSelectMixinBase implements AfterContentInit, controlType = 'mat-select'; /** Trigger that opens the select. */ - @ViewChild('trigger', {static: false}) trigger: ElementRef; + @ViewChild('trigger') trigger: ElementRef; /** Panel containing the select options. */ - @ViewChild('panel', {static: false}) panel: ElementRef; + @ViewChild('panel') panel: ElementRef; /** Overlay pane containing the options. */ - @ViewChild(CdkConnectedOverlay, {static: false}) overlayDir: CdkConnectedOverlay; + @ViewChild(CdkConnectedOverlay) overlayDir: CdkConnectedOverlay; /** All of the defined select options. */ @ContentChildren(MatOption, {descendants: true}) options: QueryList; @@ -350,7 +350,7 @@ export class MatSelect extends _MatSelectMixinBase implements AfterContentInit, @Input() panelClass: string|string[]|Set|{[key: string]: any}; /** User-supplied override of the trigger element. */ - @ContentChild(MatSelectTrigger, {static: false}) customTrigger: MatSelectTrigger; + @ContentChild(MatSelectTrigger) customTrigger: MatSelectTrigger; /** Placeholder to be shown if no value has been selected. */ @Input() diff --git a/src/material/sidenav/drawer.spec.ts b/src/material/sidenav/drawer.spec.ts index 51cc63fd4bd9..019e9ddae15d 100644 --- a/src/material/sidenav/drawer.spec.ts +++ b/src/material/sidenav/drawer.spec.ts @@ -865,7 +865,7 @@ class DrawerContainerNoDrawerTestApp { } `, }) class DrawerContainerTwoDrawerTestApp { - @ViewChild(MatDrawerContainer, {static: false}) drawerContainer: MatDrawerContainer; + @ViewChild(MatDrawerContainer) drawerContainer: MatDrawerContainer; } /** Test component that contains an MatDrawerContainer and one MatDrawer. */ @@ -891,10 +891,10 @@ class BasicTestApp { backdropClickedCount = 0; hasBackdrop: boolean | null = null; - @ViewChild('drawer', {static: false}) drawer: MatDrawer; - @ViewChild('drawerButton', {static: false}) drawerButton: ElementRef; - @ViewChild('openButton', {static: false}) openButton: ElementRef; - @ViewChild('closeButton', {static: false}) closeButton: ElementRef; + @ViewChild('drawer') drawer: MatDrawer; + @ViewChild('drawerButton') drawerButton: ElementRef; + @ViewChild('openButton') openButton: ElementRef; + @ViewChild('closeButton') closeButton: ElementRef; open() { this.openCount++; @@ -997,7 +997,7 @@ class DrawerWithoutFocusableElements {} `, }) class DrawerDelayed { - @ViewChild(MatDrawer, {static: false}) drawer: MatDrawer; + @ViewChild(MatDrawer) drawer: MatDrawer; showDrawer = false; } @@ -1009,8 +1009,8 @@ class DrawerDelayed { `, }) class DrawerContainerStateChangesTestApp { - @ViewChild(MatDrawer, {static: false}) drawer: MatDrawer; - @ViewChild(MatDrawerContainer, {static: false}) drawerContainer: MatDrawerContainer; + @ViewChild(MatDrawer) drawer: MatDrawer; + @ViewChild(MatDrawerContainer) drawerContainer: MatDrawerContainer; direction: Direction = 'ltr'; mode = 'side'; @@ -1028,8 +1028,8 @@ class DrawerContainerStateChangesTestApp { `, }) class AutosizeDrawer { - @ViewChild(MatDrawer, {static: false}) drawer: MatDrawer; - @ViewChild(MatDrawerContainer, {static: false}) drawerContainer: MatDrawerContainer; + @ViewChild(MatDrawer) drawer: MatDrawer; + @ViewChild(MatDrawerContainer) drawerContainer: MatDrawerContainer; fillerWidth = 0; } @@ -1043,7 +1043,7 @@ class AutosizeDrawer { `, }) class DrawerContainerWithContent { - @ViewChild(MatDrawerContainer, {static: false}) drawerContainer: MatDrawerContainer; + @ViewChild(MatDrawerContainer) drawerContainer: MatDrawerContainer; } @@ -1058,8 +1058,8 @@ class DrawerContainerWithContent { `, }) class IndirectDescendantDrawer { - @ViewChild('container', {static: false}) container: MatDrawerContainer; - @ViewChild('drawer', {static: false}) drawer: MatDrawer; + @ViewChild('container') container: MatDrawerContainer; + @ViewChild('drawer') drawer: MatDrawer; } @Component({ @@ -1075,8 +1075,8 @@ class IndirectDescendantDrawer { `, }) class NestedDrawerContainers { - @ViewChild('outerContainer', {static: false}) outerContainer: MatDrawerContainer; - @ViewChild('outerDrawer', {static: false}) outerDrawer: MatDrawer; - @ViewChild('innerContainer', {static: false}) innerContainer: MatDrawerContainer; - @ViewChild('innerDrawer', {static: false}) innerDrawer: MatDrawer; + @ViewChild('outerContainer') outerContainer: MatDrawerContainer; + @ViewChild('outerDrawer') outerDrawer: MatDrawer; + @ViewChild('innerContainer') innerContainer: MatDrawerContainer; + @ViewChild('innerDrawer') innerDrawer: MatDrawer; } diff --git a/src/material/sidenav/drawer.ts b/src/material/sidenav/drawer.ts index dbbe9b65c822..6b446c466ae9 100644 --- a/src/material/sidenav/drawer.ts +++ b/src/material/sidenav/drawer.ts @@ -491,8 +491,8 @@ export class MatDrawerContainer implements AfterContentInit, DoCheck, OnDestroy /** Drawers that belong to this container. */ _drawers = new QueryList(); - @ContentChild(MatDrawerContent, {static: false}) _content: MatDrawerContent; - @ViewChild(MatDrawerContent, {static: false}) _userContent: MatDrawerContent; + @ContentChild(MatDrawerContent) _content: MatDrawerContent; + @ViewChild(MatDrawerContent) _userContent: MatDrawerContent; /** The drawer child with the `start` position. */ get start(): MatDrawer | null { return this._start; } diff --git a/src/material/sidenav/sidenav.spec.ts b/src/material/sidenav/sidenav.spec.ts index 3c4a53848c23..d0a2e1b24294 100644 --- a/src/material/sidenav/sidenav.spec.ts +++ b/src/material/sidenav/sidenav.spec.ts @@ -120,8 +120,8 @@ class SidenavWithFixedPosition { `, }) class IndirectDescendantSidenav { - @ViewChild('container', {static: false}) container: MatSidenavContainer; - @ViewChild('sidenav', {static: false}) sidenav: MatSidenav; + @ViewChild('container') container: MatSidenavContainer; + @ViewChild('sidenav') sidenav: MatSidenav; } @Component({ @@ -137,8 +137,8 @@ class IndirectDescendantSidenav { `, }) class NestedSidenavContainers { - @ViewChild('outerContainer', {static: false}) outerContainer: MatSidenavContainer; - @ViewChild('outerSidenav', {static: false}) outerSidenav: MatSidenav; - @ViewChild('innerContainer', {static: false}) innerContainer: MatSidenavContainer; - @ViewChild('innerSidenav', {static: false}) innerSidenav: MatSidenav; + @ViewChild('outerContainer') outerContainer: MatSidenavContainer; + @ViewChild('outerSidenav') outerSidenav: MatSidenav; + @ViewChild('innerContainer') innerContainer: MatSidenavContainer; + @ViewChild('innerSidenav') innerSidenav: MatSidenav; } diff --git a/src/material/sidenav/sidenav.ts b/src/material/sidenav/sidenav.ts index 41eeb77f1cc4..f905305c6dde 100644 --- a/src/material/sidenav/sidenav.ts +++ b/src/material/sidenav/sidenav.ts @@ -126,5 +126,5 @@ export class MatSidenavContainer extends MatDrawerContainer { }) _allDrawers: QueryList; - @ContentChild(MatSidenavContent, {static: false}) _content: MatSidenavContent; + @ContentChild(MatSidenavContent) _content: MatSidenavContent; } diff --git a/src/material/slide-toggle/slide-toggle.ts b/src/material/slide-toggle/slide-toggle.ts index de84cc106430..13d64e455101 100644 --- a/src/material/slide-toggle/slide-toggle.ts +++ b/src/material/slide-toggle/slide-toggle.ts @@ -114,10 +114,10 @@ export class MatSlideToggle extends _MatSlideToggleMixinBase implements OnDestro private _checked: boolean = false; /** Reference to the thumb HTMLElement. */ - @ViewChild('thumbContainer', {static: false}) _thumbEl: ElementRef; + @ViewChild('thumbContainer') _thumbEl: ElementRef; /** Reference to the thumb bar HTMLElement. */ - @ViewChild('toggleBar', {static: false}) _thumbBarEl: ElementRef; + @ViewChild('toggleBar') _thumbBarEl: ElementRef; /** Name value will be applied to the input element if present. */ @Input() name: string | null = null; @@ -171,7 +171,7 @@ export class MatSlideToggle extends _MatSlideToggleMixinBase implements OnDestro get inputId(): string { return `${this.id || this._uniqueId}-input`; } /** Reference to the underlying input element. */ - @ViewChild('input', {static: false}) _inputElement: ElementRef; + @ViewChild('input') _inputElement: ElementRef; constructor(elementRef: ElementRef, private _focusMonitor: FocusMonitor, diff --git a/src/material/slider/slider.spec.ts b/src/material/slider/slider.spec.ts index 0f9984cb968e..ad24d3925baf 100644 --- a/src/material/slider/slider.spec.ts +++ b/src/material/slider/slider.spec.ts @@ -1516,7 +1516,7 @@ class SliderWithFormControl { styles: [styles], }) class SliderWithNgModel { - @ViewChild(MatSlider, {static: false}) slider: MatSlider; + @ViewChild(MatSlider) slider: MatSlider; val: number | undefined = 0; } @@ -1540,7 +1540,7 @@ class SliderWithChangeHandler { onChange() { } onInput() { } - @ViewChild(MatSlider, {static: false}) slider: MatSlider; + @ViewChild(MatSlider) slider: MatSlider; } @Component({ @@ -1581,7 +1581,7 @@ class SliderWithNativeTabindexAttr { styles: [styles], }) class SliderWithTwoWayBinding { - @ViewChild(MatSlider, {static: false}) slider: MatSlider; + @ViewChild(MatSlider) slider: MatSlider; value = 0; } diff --git a/src/material/slider/slider.ts b/src/material/slider/slider.ts index fcc0af24476b..bce7102a36c8 100644 --- a/src/material/slider/slider.ts +++ b/src/material/slider/slider.ts @@ -455,7 +455,7 @@ export class MatSlider extends _MatSliderMixinBase private _pointerPositionOnStart: {x: number, y: number} | null; /** Reference to the inner slider wrapper element. */ - @ViewChild('sliderWrapper', {static: false}) private _sliderWrapper: ElementRef; + @ViewChild('sliderWrapper') private _sliderWrapper: ElementRef; /** * Whether mouse events should be converted to a slider position by calculating their distance diff --git a/src/material/snack-bar/snack-bar.spec.ts b/src/material/snack-bar/snack-bar.spec.ts index 4435dd0ed0b9..f1d4e5c2ec38 100644 --- a/src/material/snack-bar/snack-bar.spec.ts +++ b/src/material/snack-bar/snack-bar.spec.ts @@ -944,9 +944,7 @@ class DirectiveWithViewContainer { template: ``, }) class ComponentWithChildViewContainer { - @ViewChild(DirectiveWithViewContainer, { - static: false - }) childWithViewContainer: DirectiveWithViewContainer; + @ViewChild(DirectiveWithViewContainer) childWithViewContainer: DirectiveWithViewContainer; childComponentExists: boolean = true; @@ -964,7 +962,7 @@ class ComponentWithChildViewContainer { `, }) class ComponentWithTemplateRef { - @ViewChild(TemplateRef, {static: false}) templateRef: TemplateRef; + @ViewChild(TemplateRef) templateRef: TemplateRef; localValue: string; } diff --git a/src/material/snack-bar/testing/shared.spec.ts b/src/material/snack-bar/testing/shared.spec.ts index 0a979f815fbe..4c1680b7ea30 100644 --- a/src/material/snack-bar/testing/shared.spec.ts +++ b/src/material/snack-bar/testing/shared.spec.ts @@ -146,7 +146,7 @@ export function runHarnessTests( ` }) class SnackbarHarnessTest { - @ViewChild(TemplateRef, {static: false}) customTmpl: TemplateRef; + @ViewChild(TemplateRef) customTmpl: TemplateRef; constructor(readonly snackBar: MatSnackBar) {} diff --git a/src/material/sort/sort.spec.ts b/src/material/sort/sort.spec.ts index ee60a3d7d82c..23f8dc40c1c6 100644 --- a/src/material/sort/sort.spec.ts +++ b/src/material/sort/sort.spec.ts @@ -493,11 +493,11 @@ class SimpleMatSortApp { disabledColumnSort = false; disableAllSort = false; - @ViewChild(MatSort, {static: false}) matSort: MatSort; - @ViewChild('defaultA', {static: false}) defaultA: MatSortHeader; - @ViewChild('defaultB', {static: false}) defaultB: MatSortHeader; - @ViewChild('overrideStart', {static: false}) overrideStart: MatSortHeader; - @ViewChild('overrideDisableClear', {static: false}) overrideDisableClear: MatSortHeader; + @ViewChild(MatSort) matSort: MatSort; + @ViewChild('defaultA') defaultA: MatSortHeader; + @ViewChild('defaultB') defaultB: MatSortHeader; + @ViewChild('overrideStart') overrideStart: MatSortHeader; + @ViewChild('overrideDisableClear') overrideDisableClear: MatSortHeader; constructor (public elementRef: ElementRef) { } @@ -563,7 +563,7 @@ class FakeDataSource extends DataSource { ` }) class CdkTableMatSortApp { - @ViewChild(MatSort, {static: false}) matSort: MatSort; + @ViewChild(MatSort) matSort: MatSort; dataSource = new FakeDataSource(); columnsToRender = ['column_a', 'column_b', 'column_c']; @@ -593,7 +593,7 @@ class CdkTableMatSortApp { ` }) class MatTableMatSortApp { - @ViewChild(MatSort, {static: false}) matSort: MatSort; + @ViewChild(MatSort) matSort: MatSort; dataSource = new FakeDataSource(); columnsToRender = ['column_a', 'column_b', 'column_c']; diff --git a/src/material/stepper/stepper.ts b/src/material/stepper/stepper.ts index 9e4a15c15277..3611fb0a4329 100644 --- a/src/material/stepper/stepper.ts +++ b/src/material/stepper/stepper.ts @@ -58,7 +58,7 @@ import {MatStepperIcon, MatStepperIconContext} from './stepper-icon'; }) export class MatStep extends CdkStep implements ErrorStateMatcher { /** Content for step label given by ``. */ - @ContentChild(MatStepLabel, {static: false}) stepLabel: MatStepLabel; + @ContentChild(MatStepLabel) stepLabel: MatStepLabel; /** @breaking-change 8.0.0 remove the `?` after `stepperOptions` */ constructor(@Inject(forwardRef(() => MatStepper)) stepper: MatStepper, diff --git a/src/material/table/table.spec.ts b/src/material/table/table.spec.ts index e80b2bd91291..5a20e3f37026 100644 --- a/src/material/table/table.spec.ts +++ b/src/material/table/table.spec.ts @@ -644,7 +644,7 @@ class MatTableWithWhenRowApp { dataSource: FakeDataSource | null = new FakeDataSource(); isFourthRow = (i: number, _rowData: TestData) => i == 3; - @ViewChild(MatTable, {static: false}) table: MatTable; + @ViewChild(MatTable) table: MatTable; } @@ -685,7 +685,7 @@ class ArrayDataSourceMatTableApp implements AfterViewInit { @ViewChild(MatTable, {static: true}) table: MatTable; @ViewChild(MatPaginator, {static: true}) paginator: MatPaginator; @ViewChild(MatSort, {static: true}) sort: MatSort; - @ViewChild(MatSortHeader, {static: false}) sortHeader: MatSortHeader; + @ViewChild(MatSortHeader) sortHeader: MatSortHeader; constructor() { this.underlyingDataSource.data = []; diff --git a/src/material/tabs/tab-body.spec.ts b/src/material/tabs/tab-body.spec.ts index 0ba0a1cf96be..435fe329e432 100644 --- a/src/material/tabs/tab-body.spec.ts +++ b/src/material/tabs/tab-body.spec.ts @@ -192,7 +192,7 @@ class SimpleTabBodyApp implements AfterContentInit { position: number; origin: number | null; - @ViewChild(MatTabBody, {static: false}) tabBody: MatTabBody; + @ViewChild(MatTabBody) tabBody: MatTabBody; @ViewChild(TemplateRef, {static: true}) template: TemplateRef; constructor(private _viewContainerRef: ViewContainerRef) { } diff --git a/src/material/tabs/tab-body.ts b/src/material/tabs/tab-body.ts index 74cd829efb4b..eb5f396a2aa4 100644 --- a/src/material/tabs/tab-body.ts +++ b/src/material/tabs/tab-body.ts @@ -259,7 +259,7 @@ export abstract class _MatTabBodyBase implements OnInit, OnDestroy { } }) export class MatTabBody extends _MatTabBodyBase { - @ViewChild(PortalHostDirective, {static: false}) _portalHost: PortalHostDirective; + @ViewChild(PortalHostDirective) _portalHost: PortalHostDirective; constructor(elementRef: ElementRef, @Optional() dir: Directionality, diff --git a/src/material/tabs/tab-group.spec.ts b/src/material/tabs/tab-group.spec.ts index 9cbafb6cc449..390265cfe281 100644 --- a/src/material/tabs/tab-group.spec.ts +++ b/src/material/tabs/tab-group.spec.ts @@ -834,7 +834,7 @@ class AsyncTabsTestApp implements OnInit { class TabGroupWithSimpleApi { otherLabel = 'Fruit'; otherContent = 'Apples, grapes'; - @ViewChild('legumes', {static: false}) legumes: any; + @ViewChild('legumes') legumes: any; } @@ -924,5 +924,5 @@ class TabsWithCustomAnimationDuration {} `, }) class TabGroupWithIndirectDescendantTabs { - @ViewChild(MatTabGroup, {static: false}) tabGroup: MatTabGroup; + @ViewChild(MatTabGroup) tabGroup: MatTabGroup; } diff --git a/src/material/tabs/tab-group.ts b/src/material/tabs/tab-group.ts index 692ccfc4d2a3..fd9318bfc627 100644 --- a/src/material/tabs/tab-group.ts +++ b/src/material/tabs/tab-group.ts @@ -423,8 +423,8 @@ export abstract class _MatTabGroupBase extends _MatTabGroupMixinBase implements }) export class MatTabGroup extends _MatTabGroupBase { @ContentChildren(MatTab, {descendants: true}) _allTabs: QueryList; - @ViewChild('tabBodyWrapper', {static: false}) _tabBodyWrapper: ElementRef; - @ViewChild('tabHeader', {static: false}) _tabHeader: MatTabGroupBaseHeader; + @ViewChild('tabBodyWrapper') _tabBodyWrapper: ElementRef; + @ViewChild('tabHeader') _tabHeader: MatTabGroupBaseHeader; constructor(elementRef: ElementRef, changeDetectorRef: ChangeDetectorRef, diff --git a/src/material/tabs/tab-header.ts b/src/material/tabs/tab-header.ts index 61c3c5601c5b..9e81ed58f094 100644 --- a/src/material/tabs/tab-header.ts +++ b/src/material/tabs/tab-header.ts @@ -96,8 +96,8 @@ export class MatTabHeader extends _MatTabHeaderBase { @ViewChild(MatInkBar, {static: true}) _inkBar: MatInkBar; @ViewChild('tabListContainer', {static: true}) _tabListContainer: ElementRef; @ViewChild('tabList', {static: true}) _tabList: ElementRef; - @ViewChild('nextPaginator', {static: false}) _nextPaginator: ElementRef; - @ViewChild('previousPaginator', {static: false}) _previousPaginator: ElementRef; + @ViewChild('nextPaginator') _nextPaginator: ElementRef; + @ViewChild('previousPaginator') _previousPaginator: ElementRef; constructor(elementRef: ElementRef, changeDetectorRef: ChangeDetectorRef, diff --git a/src/material/tabs/tab-nav-bar/tab-nav-bar.spec.ts b/src/material/tabs/tab-nav-bar/tab-nav-bar.spec.ts index 8c3d4e9c1651..1cde6502fd05 100644 --- a/src/material/tabs/tab-nav-bar/tab-nav-bar.spec.ts +++ b/src/material/tabs/tab-nav-bar/tab-nav-bar.spec.ts @@ -351,7 +351,7 @@ describe('MatTabNavBar', () => { ` }) class SimpleTabNavBarTestApp { - @ViewChild(MatTabNav, {static: false}) tabNavBar: MatTabNav; + @ViewChild(MatTabNav) tabNavBar: MatTabNav; @ViewChildren(MatTabLink) tabLinks: QueryList; label = ''; diff --git a/src/material/tabs/tab-nav-bar/tab-nav-bar.ts b/src/material/tabs/tab-nav-bar/tab-nav-bar.ts index 4780f6f24f63..828efda1c858 100644 --- a/src/material/tabs/tab-nav-bar/tab-nav-bar.ts +++ b/src/material/tabs/tab-nav-bar/tab-nav-bar.ts @@ -168,8 +168,8 @@ export class MatTabNav extends _MatTabNavBase { @ViewChild(MatInkBar, {static: true}) _inkBar: MatInkBar; @ViewChild('tabListContainer', {static: true}) _tabListContainer: ElementRef; @ViewChild('tabList', {static: true}) _tabList: ElementRef; - @ViewChild('nextPaginator', {static: false}) _nextPaginator: ElementRef; - @ViewChild('previousPaginator', {static: false}) _previousPaginator: ElementRef; + @ViewChild('nextPaginator') _nextPaginator: ElementRef; + @ViewChild('previousPaginator') _previousPaginator: ElementRef; constructor(elementRef: ElementRef, @Optional() dir: Directionality, diff --git a/src/material/tabs/tab.ts b/src/material/tabs/tab.ts index feca54a4d4ea..6ddc67a0506c 100644 --- a/src/material/tabs/tab.ts +++ b/src/material/tabs/tab.ts @@ -54,7 +54,7 @@ export const MAT_TAB_GROUP = new InjectionToken('MAT_TAB_GROUP'); }) export class MatTab extends _MatTabMixinBase implements OnInit, CanDisable, OnChanges, OnDestroy { /** Content for the tab label given by ``. */ - @ContentChild(MatTabLabel, {static: false}) + @ContentChild(MatTabLabel) get templateLabel(): MatTabLabel { return this._templateLabel; } set templateLabel(value: MatTabLabel) { // Only update the templateLabel via query if there is actually diff --git a/src/material/tooltip/tooltip.spec.ts b/src/material/tooltip/tooltip.spec.ts index 0ff5e9617813..ac5cb31eef35 100644 --- a/src/material/tooltip/tooltip.spec.ts +++ b/src/material/tooltip/tooltip.spec.ts @@ -1109,8 +1109,8 @@ class BasicTooltipDemo { showButton: boolean = true; showTooltipClass = false; touchGestures: TooltipTouchGestures = 'auto'; - @ViewChild(MatTooltip, {static: false}) tooltip: MatTooltip; - @ViewChild('button', {static: false}) button: ElementRef; + @ViewChild(MatTooltip) tooltip: MatTooltip; + @ViewChild('button') button: ElementRef; } @Component({ @@ -1130,7 +1130,7 @@ class ScrollableTooltipDemo { message: string = initialTooltipMessage; showButton: boolean = true; - @ViewChild(CdkScrollable, {static: false}) scrollingContainer: CdkScrollable; + @ViewChild(CdkScrollable) scrollingContainer: CdkScrollable; scrollDown() { const scrollingContainerEl = this.scrollingContainer.getElementRef().nativeElement; @@ -1192,8 +1192,8 @@ class DataBoundAriaLabelTooltip { `, }) class TooltipOnTextFields { - @ViewChild('input', {static: false}) input: ElementRef; - @ViewChild('textarea', {static: false}) textarea: ElementRef; + @ViewChild('input') input: ElementRef; + @ViewChild('textarea') textarea: ElementRef; touchGestures: TooltipTouchGestures = 'auto'; } @@ -1207,7 +1207,7 @@ class TooltipOnTextFields { `, }) class TooltipOnDraggableElement { - @ViewChild('button', {static: false}) button: ElementRef; + @ViewChild('button') button: ElementRef; touchGestures: TooltipTouchGestures = 'auto'; } @@ -1217,8 +1217,8 @@ class TooltipOnDraggableElement { }) class TooltipDemoWithoutPositionBinding { message: any = initialTooltipMessage; - @ViewChild(MatTooltip, {static: false}) tooltip: MatTooltip; - @ViewChild('button', {static: false}) button: ElementRef; + @ViewChild(MatTooltip) tooltip: MatTooltip; + @ViewChild('button') button: ElementRef; } /** Asserts whether a tooltip directive has a tooltip instance. */ diff --git a/src/material/tree/tree.spec.ts b/src/material/tree/tree.spec.ts index a4f1e39d66da..de757a80014b 100644 --- a/src/material/tree/tree.spec.ts +++ b/src/material/tree/tree.spec.ts @@ -644,7 +644,7 @@ class SimpleMatTreeApp { underlyingDataSource = new FakeDataSource(); - @ViewChild(MatTree, {static: false}) tree: MatTree; + @ViewChild(MatTree) tree: MatTree; constructor() { this.underlyingDataSource.connect().subscribe(data => { @@ -773,7 +773,7 @@ class NestedMatTreeApp { dataSource = new MatTreeNestedDataSource(); underlyingDataSource = new FakeDataSource(); - @ViewChild(MatTree, {static: false}) tree: MatTree; + @ViewChild(MatTree) tree: MatTree; constructor() { this.underlyingDataSource.connect().subscribe(data => { @@ -809,7 +809,7 @@ class WhenNodeNestedMatTreeApp { dataSource = new MatTreeNestedDataSource(); underlyingDataSource = new FakeDataSource(); - @ViewChild(MatTree, {static: false}) tree: MatTree; + @ViewChild(MatTree) tree: MatTree; constructor() { this.underlyingDataSource.connect().subscribe(data => { @@ -849,7 +849,7 @@ class MatTreeAppWithToggle { dataSource = new MatTreeFlatDataSource(this.treeControl, this.treeFlattener); underlyingDataSource = new FakeDataSource(); - @ViewChild(MatTree, {static: false}) tree: MatTree; + @ViewChild(MatTree) tree: MatTree; constructor() { this.underlyingDataSource.connect().subscribe(data => { @@ -880,7 +880,7 @@ class NestedMatTreeAppWithToggle { dataSource = new MatTreeNestedDataSource(); underlyingDataSource = new FakeDataSource(); - @ViewChild(MatTree, {static: false}) tree: MatTree; + @ViewChild(MatTree) tree: MatTree; constructor() { this.underlyingDataSource.connect().subscribe(data => { @@ -924,7 +924,7 @@ class WhenNodeMatTreeApp { dataSource = new MatTreeFlatDataSource(this.treeControl, this.treeFlattener); underlyingDataSource = new FakeDataSource(); - @ViewChild(MatTree, {static: false}) tree: MatTree; + @ViewChild(MatTree) tree: MatTree; constructor() { this.underlyingDataSource.connect().subscribe(data => { diff --git a/src/youtube-player/youtube-player.spec.ts b/src/youtube-player/youtube-player.spec.ts index e02786502298..631047e8c576 100644 --- a/src/youtube-player/youtube-player.spec.ts +++ b/src/youtube-player/youtube-player.spec.ts @@ -339,5 +339,5 @@ class TestApp { onPlaybackRateChange = jasmine.createSpy('onPlaybackRateChange'); onError = jasmine.createSpy('onError'); onApiChange = jasmine.createSpy('onApiChange'); - @ViewChild('player', {static: false}) youtubePlayer: YouTubePlayer; + @ViewChild('player') youtubePlayer: YouTubePlayer; } diff --git a/src/youtube-player/youtube-player.ts b/src/youtube-player/youtube-player.ts index 76a720f14601..d4bdbb4d35ce 100644 --- a/src/youtube-player/youtube-player.ts +++ b/src/youtube-player/youtube-player.ts @@ -156,7 +156,7 @@ export class YouTubePlayer implements AfterViewInit, OnDestroy, OnInit { @Output() playbackRateChange = new EventEmitter(); /** The element that will be replaced by the iframe. */ - @ViewChild('youtubeContainer', {static: false}) + @ViewChild('youtubeContainer') youtubeContainer: ElementRef; private _youtubeContainer = new EventEmitter(); diff --git a/tools/tslint-rules/staticQueryRule.ts b/tools/tslint-rules/staticQueryRule.ts deleted file mode 100644 index 692595623f4b..000000000000 --- a/tools/tslint-rules/staticQueryRule.ts +++ /dev/null @@ -1,39 +0,0 @@ -import * as ts from 'typescript'; -import * as Lint from 'tslint'; - -/** - * Rule which enforces that all queries are explicitly marked as static or non-static. - * TODO(crisbeto): we can remove this once we don't support 8.0.0 anymore. - */ -export class Rule extends Lint.Rules.AbstractRule { - apply(sourceFile: ts.SourceFile): Lint.RuleFailure[] { - return this.applyWithWalker(new Walker(sourceFile, this.getOptions())); - } -} - -class Walker extends Lint.RuleWalker { - visitPropertyDeclaration(node: ts.PropertyDeclaration) { - const childQueryDecorator = node.decorators && node.decorators.find(decorator => { - const expression = (decorator.expression as ts.CallExpression); - const name = expression && expression.expression.getText(); - return name === 'ViewChild' || name === 'ContentChild'; - }); - - if (childQueryDecorator) { - const options = (childQueryDecorator.expression as ts.CallExpression).arguments[1]; - - if (!options || !ts.isObjectLiteralExpression(options) || - !this._getObjectProperty(options, 'static')) { - this.addFailureAtNode(childQueryDecorator, - 'Queries have to explicitly set the `static` option.'); - } - } - - super.visitPropertyDeclaration(node); - } - - /** Gets the node of an object property by name. */ - private _getObjectProperty(node: ts.ObjectLiteralExpression, name: string) { - return node.properties.find(property => (property.name as ts.Identifier).getText() === name); - } -} diff --git a/tslint.json b/tslint.json index bc3716a757a7..0ec3fbfdf81a 100644 --- a/tslint.json +++ b/tslint.json @@ -108,7 +108,6 @@ "ng-on-changes-property-access": true, "rxjs-imports": true, "require-breaking-change-version": true, - "static-query": true, "class-list-signatures": true, "no-host-decorator-in-concrete": [ true,