From 4fbfccb00641106d0c1ce7c8c549a21766018abb Mon Sep 17 00:00:00 2001 From: vthinkxie Date: Thu, 20 Dec 2018 17:07:42 +0800 Subject: [PATCH] fix(module:layout): fix sider nzBreakPoint (#2665) close #2603 --- components/input/nz-autoresize.directive.ts | 2 +- components/layout/nz-sider.component.ts | 5 +++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/components/input/nz-autoresize.directive.ts b/components/input/nz-autoresize.directive.ts index 88104f7bd8c..d231bca49ed 100644 --- a/components/input/nz-autoresize.directive.ts +++ b/components/input/nz-autoresize.directive.ts @@ -11,7 +11,7 @@ import { } from '@angular/core'; import { NgControl } from '@angular/forms'; import { fromEvent, Subject } from 'rxjs'; -import { auditTime, startWith, takeUntil } from 'rxjs/operators'; +import { auditTime, takeUntil } from 'rxjs/operators'; export interface AutoSizeType { minRows?: number; diff --git a/components/layout/nz-sider.component.ts b/components/layout/nz-sider.component.ts index 19d68de49d2..0f30ef0150e 100644 --- a/components/layout/nz-sider.component.ts +++ b/components/layout/nz-sider.component.ts @@ -20,7 +20,7 @@ import { import { MediaMatcher } from '@angular/cdk/layout'; import { Platform } from '@angular/cdk/platform'; import { fromEvent, Subject } from 'rxjs'; -import { auditTime, startWith, takeUntil } from 'rxjs/operators'; +import { auditTime, takeUntil } from 'rxjs/operators'; import { InputBoolean } from '../core/util/convert'; import { NzLayoutComponent } from './nz-layout.component'; @@ -111,9 +111,10 @@ export class NzSiderComponent implements OnInit, AfterViewInit, OnDestroy { ngAfterViewInit(): void { if (this.platform.isBrowser) { + Promise.resolve().then(() => this.watchMatchMedia()); this.ngZone.runOutsideAngular(() => { fromEvent(window, 'resize') - .pipe(startWith(null), auditTime(16), takeUntil(this.destroy$)) + .pipe(auditTime(16), takeUntil(this.destroy$)) .subscribe(() => this.watchMatchMedia()); }); }