Skip to content

Commit

Permalink
Merge pull request #2702 from amcdnl/entry-comps
Browse files Browse the repository at this point in the history
fix: add entry components to modulemetadata - #2701
  • Loading branch information
igor-dv authored Jan 9, 2018
2 parents 748e494 + 4041ddc commit a5d439c
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
7 changes: 5 additions & 2 deletions app/angular/src/client/preview/angular/helpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ const getComponentMetadata = ({
schemas: [],
declarations: [],
providers: [],
entryComponents: [],
},
}: NgStory) => {
if (!component || typeof component !== 'function') {
Expand All @@ -73,7 +74,7 @@ const getComponentMetadata = ({
(<any>propsMetadata)[key] = (<any>propsMeta)[key];
});

const { imports = [], schemas = [], declarations = [], providers = [] } = moduleMetadata;
const { imports = [], schemas = [], declarations = [], providers = [], entryComponents = [] } = moduleMetadata;

return {
component,
Expand All @@ -86,6 +87,7 @@ const getComponentMetadata = ({
schemas,
declarations,
providers,
entryComponents,
},
};
};
Expand Down Expand Up @@ -118,13 +120,14 @@ const getModule = (
schemas: [],
declarations: [],
providers: [],
entryComponents: [],
}
): IModule => {
const moduleMeta = new NgModule({
declarations: [...declarations, ...moduleMetadata.declarations],
imports: [BrowserModule, FormsModule, ...moduleMetadata.imports],
providers: [{ provide: STORY, useValue: Object.assign({}, data) }, ...moduleMetadata.providers],
entryComponents: [...entryComponents],
entryComponents: [...entryComponents, ...moduleMetadata.entryComponents],
schemas: [...moduleMetadata.schemas],
bootstrap: [...bootstrap],
});
Expand Down
1 change: 1 addition & 0 deletions app/angular/src/client/preview/angular/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ export interface NgModuleMetadata {
imports: Array<any>;
schemas: Array<any>;
providers: Array<any>;
entryComponents: Array<any>;
}

export interface ICollection {
Expand Down

0 comments on commit a5d439c

Please sign in to comment.