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 0316a24ed0..7674671cdd 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 @@ -8,12 +8,13 @@ import {Injectable, Optional} from '../di'; -import {global} from '../facade/lang'; import {Compiler} from './compiler'; import {NgModuleFactory} from './ng_module_factory'; import {NgModuleFactoryLoader} from './ng_module_factory_loader'; +declare var System: {import: (module: string) => Promise;}; + const _SEPARATOR = '#'; const FACTORY_MODULE_SUFFIX = '.ngfactory'; @@ -36,8 +37,7 @@ export class SystemJsNgModuleLoader implements NgModuleFactoryLoader { let [module, exportName] = path.split(_SEPARATOR); if (exportName === undefined) exportName = 'default'; - return (global) - .System.import(module) + return System.import(module) .then((module: any) => module[exportName]) .then((type: any) => checkNotEmpty(type, module, exportName)) .then((type: any) => this._compiler.compileModuleAsync(type)); @@ -47,8 +47,7 @@ export class SystemJsNgModuleLoader implements NgModuleFactoryLoader { let [module, exportName] = path.split(_SEPARATOR); if (exportName === undefined) exportName = 'default'; - return (global) - .System.import(module + FACTORY_MODULE_SUFFIX) + return System.import(module + FACTORY_MODULE_SUFFIX) .then((module: any) => module[exportName + FACTORY_CLASS_SUFFIX]) .then((factory: any) => checkNotEmpty(factory, module, exportName)); } diff --git a/modules/@angular/core/src/linker/systemjs_component_resolver.ts b/modules/@angular/core/src/linker/systemjs_component_resolver.ts index 1f45e65b04..3736800251 100644 --- a/modules/@angular/core/src/linker/systemjs_component_resolver.ts +++ b/modules/@angular/core/src/linker/systemjs_component_resolver.ts @@ -8,11 +8,13 @@ import {Console} from '../console'; import {Injectable} from '../di'; -import {global, isString} from '../facade/lang'; +import {isString} from '../facade/lang'; import {Type} from '../type'; import {ComponentFactory} from './component_factory'; import {ComponentResolver} from './component_resolver'; +declare var System: {import: (module: string) => Promise;}; + const _SEPARATOR = '#'; /** @@ -36,9 +38,8 @@ export class SystemJsComponentResolver implements ComponentResolver { component = 'default'; } - return (global) - .System.import(module) - .then((module: any) => this._resolver.resolveComponent(module[component])); + return System.import(module).then( + (module: any) => this._resolver.resolveComponent(module[component])); } return this._resolver.resolveComponent(componentType); @@ -64,8 +65,7 @@ export class SystemJsCmpFactoryResolver implements ComponentResolver { if (isString(componentType)) { this._console.warn(ComponentResolver.LazyLoadingDeprecationMsg); let [module, factory] = componentType.split(_SEPARATOR); - return (global) - .System.import(module + FACTORY_MODULE_SUFFIX) + return System.import(module + FACTORY_MODULE_SUFFIX) .then((module: any) => module[factory + FACTORY_CLASS_SUFFIX]); }