feat(core): expose a Compiler API for accessing module ids from NgModule types (#24258)

This will allow RouterTestingModule to better support lazy loading of modules
when using summaries, since it can detect whether a module is already loaded
if it can access the id.

PR Close #24258
This commit is contained in:
Alex Rickabaugh
2018-06-01 12:02:48 -07:00
committed by Miško Hevery
parent e3759f7a73
commit bd02b27ee1
5 changed files with 31 additions and 1 deletions

View File

@ -99,4 +99,8 @@ export class TestingCompilerImpl implements TestingCompiler {
clearCacheFor(type: Type<any>) { this._compiler.clearCacheFor(type); }
getComponentFromError(error: Error) { return (error as any)[ERROR_COMPONENT_TYPE] || null; }
getModuleId(moduleType: Type<any>): string|undefined {
return this._moduleResolver.resolve(moduleType, true).id;
}
}