diff --git a/components/switch/nz-switch.component.ts b/components/switch/nz-switch.component.ts index 6b56c3f13b8..673c1547ff5 100644 --- a/components/switch/nz-switch.component.ts +++ b/components/switch/nz-switch.component.ts @@ -54,7 +54,7 @@ export class NzSwitchComponent implements ControlValueAccessor, AfterViewInit, O checked = false; onChange: (value: boolean) => void = () => null; onTouched: () => void = () => null; - @ViewChild('switchElement', { static: false }) private switchElement: ElementRef; + @ViewChild('switchElement', { static: true }) private switchElement: ElementRef; @Input() @InputBoolean() nzLoading = false; @Input() @InputBoolean() nzDisabled = false; @Input() @InputBoolean() nzControl = false;