fix(compiler): error when NgModule.bootstrap contains undefined or null

This commit is contained in:
Tobias Bosch
2016-09-06 09:55:48 -07:00
committed by Martin Probst
parent aa9b617c9d
commit ea95c391c1
2 changed files with 25 additions and 3 deletions

View File

@ -304,9 +304,14 @@ export class CompileMetadataResolver {
.map(type => this.getTypeMetadata(type, staticTypeModuleUrl(type))));
}
if (meta.bootstrap) {
bootstrapComponents.push(
...flattenArray(meta.bootstrap)
.map(type => this.getTypeMetadata(type, staticTypeModuleUrl(type))));
const typeMetadata = flattenArray(meta.bootstrap).map(type => {
if (!isValidType(type)) {
throw new Error(
`Unexpected value '${stringify(type)}' used in the bootstrap property of module '${stringify(moduleType)}'`);
}
return this.getTypeMetadata(type, staticTypeModuleUrl(type));
});
bootstrapComponents.push(...typeMetadata);
}
entryComponents.push(...bootstrapComponents);
if (meta.schemas) {