Skip to content

Commit

Permalink
fix(module:affix): fix position offset when has deferred render compo…
Browse files Browse the repository at this point in the history
…nets. (#672)

close #671
  • Loading branch information
cipchk authored and vthinkxie committed Dec 5, 2017
1 parent 5e341de commit 74b01da
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions src/components/affix/nz-affix.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@ import {
Output,
OnDestroy,
ViewChild,
ElementRef
ElementRef,
AfterViewInit
} from '@angular/core';
import { fromEvent } from 'rxjs/observable/fromEvent';
import { Subscription } from 'rxjs/Subscription';
Expand All @@ -28,7 +29,7 @@ import { NzScrollService } from '../core/scroll/nz-scroll.service';
'./style/patch.less'
]
})
export class NzAffixComponent implements OnInit, OnDestroy {
export class NzAffixComponent implements OnInit, OnDestroy, AfterViewInit {

private didScroll = false;
private scrollTime: any = null;
Expand Down Expand Up @@ -62,6 +63,11 @@ export class NzAffixComponent implements OnInit, OnDestroy {
}
}

ngAfterViewInit(): void {
this.orgOffset = null;
this.fixed = false;
}

private getTarget(): Element | Window {
return this.target || window;
}
Expand Down

0 comments on commit 74b01da

Please sign in to comment.