diff --git a/modules/@angular/core/src/linker/system_js_ng_module_factory_loader.ts b/modules/@angular/core/src/linker/system_js_ng_module_factory_loader.ts index 28232be4cf..0316a24ed0 100644 --- a/modules/@angular/core/src/linker/system_js_ng_module_factory_loader.ts +++ b/modules/@angular/core/src/linker/system_js_ng_module_factory_loader.ts @@ -25,10 +25,11 @@ const FACTORY_CLASS_SUFFIX = 'NgFactory'; */ @Injectable() export class SystemJsNgModuleLoader implements NgModuleFactoryLoader { - constructor(@Optional() private _compiler: Compiler) {} + constructor(private _compiler: Compiler) {} load(path: string): Promise> { - return this._compiler ? this.loadAndCompile(path) : this.loadFactory(path); + const offlineMode = this._compiler instanceof Compiler; + return offlineMode ? this.loadFactory(path) : this.loadAndCompile(path); } private loadAndCompile(path: string): Promise> {