Skip to content

Instantly share code, notes, and snippets.

@topnotch48
Last active April 22, 2018 14:10
Show Gist options
  • Save topnotch48/a03b626c600c99c90c452815f6ab0adc to your computer and use it in GitHub Desktop.
Save topnotch48/a03b626c600c99c90c452815f6ab0adc to your computer and use it in GitHub Desktop.
get(token: any, notFoundValue: any = Injector.THROW_IF_NOT_FOUND) {
this._initIfNeeded();
if (token === TestBed) {
return this;
}
const result = this._moduleRef.injector.get(token, UNDEFINED);
return result === UNDEFINED ? this._compiler.injector.get(token, notFoundValue) : result;
}
compileComponents(): Promise<any> {
if (this._moduleFactory || this._instantiated) {
return Promise.resolve(null);
}
const moduleType = this._createCompilerAndModule();
return this._compiler.compileModuleAndAllComponentsAsync(moduleType)
.then((moduleAndComponentFactories) => {
this._moduleFactory = moduleAndComponentFactories.ngModuleFactory;
});
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment