Revert "refactor(core): tree-shake application_module providers (#23477)"

This reverts commit ac2b530f4b.

The change is breaking targets in g3 see cl/194336387.
This commit is contained in:
Igor Minar
2018-04-27 07:13:39 -07:00
parent ac2b530f4b
commit e47bb52084
7 changed files with 20 additions and 58 deletions

View File

@ -16,8 +16,7 @@ import {isPromise} from '../src/util/lang';
import {ApplicationInitStatus} from './application_init';
import {APP_BOOTSTRAP_LISTENER, PLATFORM_INITIALIZER} from './application_tokens';
import {Console} from './console';
import {Injectable, InjectionToken, Injector, StaticProvider, inject} from './di';
import {defineInjectable} from './di/defs';
import {Injectable, InjectionToken, Injector, StaticProvider} from './di';
import {CompilerFactory, CompilerOptions} from './linker/compiler';
import {ComponentFactory, ComponentRef} from './linker/component_factory';
import {ComponentFactoryBoundToModule, ComponentFactoryResolver} from './linker/component_factory_resolver';
@ -362,26 +361,8 @@ function optionsReducer<T extends Object>(dst: any, objs: T | T[]): T {
*
*
*/
@Injectable()
export class ApplicationRef {
// `ngInjectableDef` is required in core-level code because it sits behind
// the injector and any code the loads it inside may run into a dependency
// loop (because Injectable is also in core. Do not use the code below
// (use @Injectable({ providedIn, factory })) instead...
/**
* @internal
* @nocollapse
*/
static ngInjectableDef = defineInjectable({
providedIn: 'root',
factory: function ApplicationRef_Factory() {
// Type as any is used here due to a type-related bug in injector with abstract classes
// (#23528)
return new ApplicationRef(
inject(NgZone), inject(Console), inject(Injector as any), inject(ErrorHandler),
inject(ComponentFactoryResolver as any), inject(ApplicationInitStatus));
}
});
/** @internal */
static _tickScope: WtfScopeFn = wtfCreateScope('ApplicationRef#tick()');
private _bootstrapListeners: ((compRef: ComponentRef<any>) => void)[] = [];