Browse Source

fix: store subscription of shouldRender

pull/8274/head
bnymncoskuner 6 years ago
parent
commit
ff0e79425b
  1. 4
      npm/ng-packs/packages/components/page/src/page-part.directive.ts

4
npm/ng-packs/packages/components/page/src/page-part.directive.ts

@ -18,7 +18,7 @@ import { Observable, Subscription, of } from 'rxjs';
export interface PageRenderStrategy { export interface PageRenderStrategy {
shouldRender(type?: string): boolean | Observable<boolean>; shouldRender(type?: string): boolean | Observable<boolean>;
onInit?(type?: string, injector?: Injector, context?: any): void; onInit?(type?: string, injector?: Injector, context?: any): void;
onDestroy?(type: string, injector?: Injector, context?: any): void; onDestroy?(type?: string, injector?: Injector, context?: any): void;
onContextUpdate?(change?: SimpleChange): void; onContextUpdate?(change?: SimpleChange): void;
} }
@ -84,7 +84,7 @@ export class PagePartDirective implements OnInit, OnDestroy, OnChanges {
protected createRenderStream(type: string) { protected createRenderStream(type: string) {
this.clearSubscription(); this.clearSubscription();
this.shouldRender(type).subscribe(this.render); this.subscription = this.shouldRender(type).subscribe(this.render);
} }
protected clearSubscription() { protected clearSubscription() {

Loading…
Cancel
Save