Skip to content
This repository has been archived by the owner on Dec 10, 2022. It is now read-only.

Commit

Permalink
fix(preset): Merge prototypes as well
Browse files Browse the repository at this point in the history
So all methods will be available
  • Loading branch information
gund committed Dec 31, 2017
1 parent ef436e8 commit 4386732
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions src/preset/preset.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,10 @@ import { PRESET_TYPES_TOKEN, PresetType } from './preset-token';
@Injectable()
export class PresetService implements OnDestroy {

private presetTypes = this.injector.get(PRESET_TYPES_TOKEN);
private get presetTypes() {
return this.injector.get(PRESET_TYPES_TOKEN);
}

private presetCompRefs: ComponentRef<any>[] = [];
private finalPresetComp: any;

Expand Down Expand Up @@ -41,8 +44,11 @@ export class PresetService implements OnDestroy {
}

private mergeCompRefs<T>(compRefs: ComponentRef<T>[]): T {
const proto = compRefs.reduce((comp, compRef) =>
Object.assign(comp, compRef.instance.constructor.prototype), {});

return compRefs.reduce((comp, compRef) =>
Object.assign(comp, compRef.instance), {} as T);
Object.assign(comp, compRef.instance), proto as T);
}

}

0 comments on commit 4386732

Please sign in to comment.