Skip to content

Instantly share code, notes, and snippets.

@bob-lee
Created November 2, 2018 14:16
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bob-lee/711bb27e225febd72652da682f59dcca to your computer and use it in GitHub Desktop.
Save bob-lee/711bb27e225febd72652da682f59dcca to your computer and use it in GitHub Desktop.
export class LazyLoadDirective implements AfterViewInit, OnDestroy {
public ngAfterViewInit() {
if (this._service.delayMsec > 0) { // register later
const sub = this._service.announcedOrder.pipe(first()).subscribe(_ => this.doRegister());
this._subscription.add(sub);
} else { // register now (default)
this.doRegister();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment