Exemplo n.º 1
0
 MeteorApp.bootstrap = function (component, platProviders, appProviders, providers) {
     var platRef = core_1.getPlatform();
     if (lang_1.isBlank(platRef)) {
         platRef = core_2.createPlatform(core_2.ReflectiveInjector.resolveAndCreate(platProviders));
     }
     appProviders = lang_1.isPresent(providers) ? appProviders.concat(providers) : appProviders;
     appProviders.push(core_1.provide(MeteorApp, {
         deps: [core_1.ApplicationRef],
         useFactory: function (appRef) {
             var elem = appRef._rootCompRef.location.nativeElement;
             return exports.appRegistry.get(elem);
         },
     }));
     var appInjector = core_2.ReflectiveInjector.resolveAndCreate(appProviders, platRef.injector);
     var appRef = appInjector.get(core_1.ApplicationRef);
     var newApp = new MeteorApp(appRef);
     return new Promise(function (resolve, reject) {
         Meteor.startup(function () {
             return core_2.coreLoadAndBootstrap(component, appInjector)
                 .then(function (compRef) {
                 // It's ok since one app can bootstrap
                 // one component currently.
                 appRef._rootCompRef = compRef;
                 var elem = compRef.location.nativeElement;
                 exports.appRegistry.register(elem, newApp);
                 appRef.registerDisposeListener(function () {
                     exports.appRegistry.unregister(elem);
                     delete appRef._rootCompRef;
                 });
                 return compRef;
             })
                 .then(resolve, reject);
         });
     });
 };
Exemplo n.º 2
0
 MeteorApp.bootstrap = function (component, platProviders, appProviders, providers) {
     var platRef = core_1.getPlatform();
     if (lang_1.isBlank(platRef)) {
         platRef = core_2.createPlatform(core_2.ReflectiveInjector.resolveAndCreate(platProviders));
     }
     appProviders = lang_1.isPresent(providers) ? [appProviders, providers] : appProviders;
     var appInjector = core_2.ReflectiveInjector.resolveAndCreate(appProviders, platRef.injector);
     var appRef = appInjector.get(core_1.ApplicationRef);
     return this.launch(appRef, function () { return core_2.coreLoadAndBootstrap(appInjector, component); });
 };
 NavControllerBase.prototype._viewInit = function (enteringView) {
     var componentProviders = core_1.ReflectiveInjector.resolve([
         { provide: nav_controller_1.NavController, useValue: this },
         { provide: view_controller_1.ViewController, useValue: enteringView },
         { provide: nav_params_1.NavParams, useValue: enteringView.getNavParams() }
     ]);
     var componentFactory = this._cfr.resolveComponentFactory(enteringView.component);
     var childInjector = core_1.ReflectiveInjector.fromResolvedProviders(componentProviders, this._viewport.parentInjector);
     enteringView.init(componentFactory.create(childInjector, []));
     enteringView._state = nav_util_1.ViewState.INITIALIZED;
     this._preLoad(enteringView);
 };
Exemplo n.º 4
0
 _viewInit(enteringView) {
     const componentProviders = ReflectiveInjector.resolve([
         { provide: NavController, useValue: this },
         { provide: ViewController, useValue: enteringView },
         { provide: NavParams, useValue: enteringView.getNavParams() }
     ]);
     const componentFactory = this._cfr.resolveComponentFactory(enteringView.component);
     const childInjector = ReflectiveInjector.fromResolvedProviders(componentProviders, this._viewport.parentInjector);
     enteringView.init(componentFactory.create(childInjector, []));
     enteringView._state = ViewState.INITIALIZED;
     this._willLoad(enteringView);
 }
Exemplo n.º 5
0
 NavControllerBase.prototype._viewInit = function (enteringView) {
     // entering view has not been initialized yet
     var componentProviders = ReflectiveInjector.resolve([
         { provide: NavController, useValue: this },
         { provide: ViewController, useValue: enteringView },
         { provide: NavParams, useValue: enteringView.getNavParams() }
     ]);
     var componentFactory = this._cfr.resolveComponentFactory(enteringView.component);
     var childInjector = ReflectiveInjector.fromResolvedProviders(componentProviders, this._viewport.parentInjector);
     // create ComponentRef and set it to the entering view
     enteringView.init(componentFactory.create(childInjector, []));
     enteringView._state = ViewState.INITIALIZED;
     this._preLoad(enteringView);
 };
Exemplo n.º 6
0
 var showTooltip = function () {
     _this.visible = true;
     var options = new tooltip_options_class_1.TooltipOptions({
         content: _this.content,
         htmlContent: _this.htmlContent,
         placement: _this.placement,
         animation: _this.animation,
         appendToBody: _this.appendToBody,
         hostEl: _this.viewContainerRef.element,
         popupClass: _this.popupClass,
         context: _this.tooltipContext
     });
     if (_this.appendToBody) {
         _this.tooltip = _this.componentsHelper
             .appendNextToRoot(tooltip_container_component_1.TooltipContainerComponent, tooltip_options_class_1.TooltipOptions, options);
     }
     else {
         var binding = core_1.ReflectiveInjector.resolve([
             { provide: tooltip_options_class_1.TooltipOptions, useValue: options }
         ]);
         _this.tooltip = _this.componentsHelper
             .appendNextToLocation(tooltip_container_component_1.TooltipContainerComponent, _this.viewContainerRef, binding);
     }
     _this.changeDetectorRef.markForCheck();
     _this.triggerStateChanged();
 };
Exemplo n.º 7
0
 placeComponentIntoOutlet(outletMap, future, outlet) {
     const resolved = ReflectiveInjector.resolve([
         { provide: ActivatedRoute, useValue: future },
         { provide: RouterOutletMap, useValue: outletMap }
     ]);
     outlet.activate(future, resolved, outletMap);
 }
 RouterOutlet.prototype.activate = function (nextInstruction) {
     var _this = this;
     var previousInstruction = this._currentInstruction;
     this._currentInstruction = nextInstruction;
     var componentType = nextInstruction.componentType;
     var childRouter = this._parentRouter.childRouter(componentType);
     var providers = core_1.ReflectiveInjector.resolve([
         { provide: instruction_1.RouteData, useValue: nextInstruction.routeData },
         { provide: instruction_1.RouteParams, useValue: new instruction_1.RouteParams(nextInstruction.params) },
         { provide: routerMod.Router, useValue: childRouter }
     ]);
     this._componentRef =
         this._loader.loadNextToLocation(componentType, this._viewContainerRef, providers);
     return this._componentRef.then(function (componentRef) {
         _this.activateEvents.emit(componentRef.instance);
         if (route_lifecycle_reflector_1.hasLifecycleHook(hookMod.routerOnActivate, componentType)) {
             return _this._componentRef.then(function (ref) {
                 return ref.instance.routerOnActivate(nextInstruction, previousInstruction);
             });
         }
         else {
             return componentRef;
         }
     });
 };
Exemplo n.º 9
0
/**
 * @experimental
 */
function bootstrapWorkerApp(appComponentType, customProviders) {
    var appInjector = core_1.ReflectiveInjector.resolveAndCreate([
        platform_browser_1.WORKER_APP_APPLICATION_PROVIDERS, WORKER_APP_COMPILER_PROVIDERS,
        lang_1.isPresent(customProviders) ? customProviders : []
    ], platform_browser_1.workerAppPlatform().injector);
    return core_1.coreLoadAndBootstrap(appComponentType, appInjector);
}
    beforeEach(function () {
        /* eslint-disable indent */
        var injector = ReflectiveInjector.resolveAndCreate([
                AudioBufferWrapper,
                AudioNodeConnectMethodWrapper,
                AudioNodeDisconnectMethodWrapper,
                ChainingSupportTester,
                DisconnectingSupportTester,
                EncodingErrorFactory,
                InvalidStateErrorFactory,
                NotSupportedErrorFactory,
                OfflineAudioBufferSourceNodeFakerFactory,
                OfflineAudioDestinationNodeFakerFactory,
                OfflineBiquadFilterNodeFakerFactory,
                OfflineGainNodeFakerFactory,
                OfflineIIRFilterNodeFakerFactory,
                PromiseSupportTester,
                { provide: offlineAudioContextConstructor, useFactory: offlineAudioContextConstructor },
                { provide: unpatchedOfflineAudioContextConstructor, useFactory: unpatchedOfflineAudioContextConstructor },
                { provide: wndw, useValue: window }
            ]);
        /* eslint-enable indent */

        OfflineAudioContext = injector.get(offlineAudioContextConstructor);

        // Chrome, Firefox and maybe others as well do not call a ScriptProcessorNode if the length
        // is 128 samples or less.
        offlineAudioContext = new OfflineAudioContext(2, 129, 44100);
    });
Exemplo n.º 11
0
export function bootstrapWorkerApp(appComponentType, customProviders) {
    var appInjector = ReflectiveInjector.resolveAndCreate([
        WORKER_APP_APPLICATION_PROVIDERS, WORKER_APP_COMPILER_PROVIDERS,
        isPresent(customProviders) ? customProviders : []
    ], workerAppPlatform().injector);
    return coreLoadAndBootstrap(appComponentType, appInjector);
}
Exemplo n.º 12
0
 Modal.prototype.createModal = function (dialogRef, backdrop, container) {
     var /** @type {?} */ b = ReflectiveInjector.resolve([{ provide: DialogRef, useValue: dialogRef }]);
     return {
         backdropRef: dialogRef.overlayRef.instance.addComponent(backdrop, b),
         containerRef: dialogRef.overlayRef.instance.addComponent(container, b)
     };
 };
Exemplo n.º 13
0
 TypeaheadDirective.prototype.show = function () {
     var options = new typeahead_options_class_1.TypeaheadOptions({
         typeaheadRef: this,
         placement: this.placement,
         animation: false
     });
     var binding = core_1.ReflectiveInjector.resolve([
         { provide: typeahead_options_class_1.TypeaheadOptions, useValue: options }
     ]);
     this.popup = this.componentsHelper
         .appendNextToLocation(typeahead_container_component_1.TypeaheadContainerComponent, this.viewContainerRef, binding);
     this.popup.instance.position(this.viewContainerRef.element);
     this.container = this.popup.instance;
     this.container.parent = this;
     // This improves the speed as it won't have to be done for each list item
     var normalizedQuery = (this.typeaheadLatinize
         ? typeahead_utils_1.TypeaheadUtils.latinize(this.ngControl.control.value)
         : this.ngControl.control.value).toString()
         .toLowerCase();
     this.container.query = this.typeaheadSingleWords
         ? typeahead_utils_1.TypeaheadUtils.tokenize(normalizedQuery, this.typeaheadWordDelimiters, this.typeaheadPhraseDelimiters)
         : normalizedQuery;
     this.container.matches = this._matches;
     this.element.nativeElement.focus();
 };
Exemplo n.º 14
0
 TestBed.prototype._initIfNeeded = function () {
     if (this._instantiated) {
         return;
     }
     if (!this._moduleWithComponentFactories) {
         try {
             var moduleType = this._createCompilerAndModule();
             this._moduleWithComponentFactories =
                 this._compiler.compileModuleAndAllComponentsSync(moduleType);
         }
         catch (e) {
             if (getComponentType(e)) {
                 throw new Error("This test module uses the component " + ɵstringify(getComponentType(e)) + " which is using a \"templateUrl\" or \"styleUrls\", but they were never compiled. " +
                     "Please call \"TestBed.compileComponents\" before your test.");
             }
             else {
                 throw e;
             }
         }
     }
     var ngZone = new NgZone({ enableLongStackTrace: true });
     var ngZoneInjector = ReflectiveInjector.resolveAndCreate([{ provide: NgZone, useValue: ngZone }], this.platform.injector);
     this._moduleRef = this._moduleWithComponentFactories.ngModuleFactory.create(ngZoneInjector);
     // ApplicationInitStatus.runInitializers() is marked @internal to core. So casting to any
     // before accessing it.
     this._moduleRef.injector.get(ApplicationInitStatus).runInitializers();
     this._instantiated = true;
 };
Exemplo n.º 15
0
 _initIfNeeded() {
     if (this._instantiated) {
         return;
     }
     if (!this._moduleWithComponentFactories) {
         try {
             const moduleType = this._createCompilerAndModule();
             this._moduleWithComponentFactories =
                 this._compiler.compileModuleAndAllComponentsSync(moduleType);
         }
         catch (e) {
             if (getComponentType(e)) {
                 throw new Error(`This test module uses the component ${ɵstringify(getComponentType(e))} which is using a "templateUrl" or "styleUrls", but they were never compiled. ` +
                     `Please call "TestBed.compileComponents" before your test.`);
             }
             else {
                 throw e;
             }
         }
     }
     const ngZone = new NgZone({ enableLongStackTrace: true });
     const ngZoneInjector = ReflectiveInjector.resolveAndCreate([{ provide: NgZone, useValue: ngZone }], this.platform.injector);
     this._moduleRef = this._moduleWithComponentFactories.ngModuleFactory.create(ngZoneInjector);
     this._instantiated = true;
 }
Exemplo n.º 16
0
 bootstrapNg2() {
     var childInjector = ReflectiveInjector.resolveAndCreate([{ provide: NG1_SCOPE, useValue: this.componentScope }], this.parentInjector);
     this.contentInsertionPoint = document.createComment('ng1 insertion point');
     this.componentRef = this.componentFactory.create(childInjector, [[this.contentInsertionPoint]], this.element[0]);
     this.changeDetector = this.componentRef.changeDetectorRef;
     this.component = this.componentRef.instance;
 }
 DowngradeNg2ComponentAdapter.prototype.bootstrapNg2 = function() {
   var childInjector = core_1.ReflectiveInjector.resolveAndCreate([core_1.provide(constants_1.NG1_SCOPE, {useValue: this.componentScope})], this.parentInjector);
   this.contentInsertionPoint = document.createComment('ng1 insertion point');
   this.componentRef = this.componentFactory.create(childInjector, [[this.contentInsertionPoint]], '#' + this.id);
   this.changeDetector = this.componentRef.changeDetectorRef;
   this.component = this.componentRef.instance;
 };
Exemplo n.º 18
0
 RuntimeCompilerFactory.prototype.createCompiler = function (options) {
     if (options === void 0) { options = []; }
     var mergedOptions = _mergeOptions(this._defaultOptions.concat(options));
     var injector = ReflectiveInjector.resolveAndCreate([
         COMPILER_PROVIDERS, {
             provide: CompilerConfig,
             useFactory: function () {
                 return new CompilerConfig({
                     // let explicit values from the compiler options overwrite options
                     // from the app providers. E.g. important for the testing platform.
                     genDebugInfo: mergedOptions.useDebug,
                     // let explicit values from the compiler options overwrite options
                     // from the app providers
                     useJit: mergedOptions.useJit,
                     // let explicit values from the compiler options overwrite options
                     // from the app providers
                     defaultEncapsulation: mergedOptions.defaultEncapsulation,
                     logBindingUpdate: mergedOptions.useDebug
                 });
             },
             deps: []
         },
         mergedOptions.providers
     ]);
     return injector.get(Compiler);
 };
Exemplo n.º 19
0
 ActivateRoutes.prototype.placeComponentIntoOutlet = function (outletMap, future, outlet) {
     var resolved = core_1.ReflectiveInjector.resolve([
         { provide: router_state_1.ActivatedRoute, useValue: future },
         { provide: router_outlet_map_1.RouterOutletMap, useValue: outletMap }
     ]);
     outlet.activate(future, resolved, outletMap);
 };
 RouterOutlet.prototype.activate = function (activatedRoute, providers, outletMap) {
     this.outletMap = outletMap;
     this._activatedRoute = activatedRoute;
     var snapshot = activatedRoute._futureSnapshot;
     var component = snapshot._routeConfig.component;
     var factory;
     try {
         factory = typeof component === 'string' ?
             snapshot._resolvedComponentFactory :
             this.componentFactoryResolver.resolveComponentFactory(component);
     }
     catch (e) {
         if (!(e instanceof core_1.NoComponentFactoryError))
             throw e;
         // TODO: vsavkin uncomment this once ComponentResolver is deprecated
         // const componentName = component ? component.name : null;
         // console.warn(
         //     `'${componentName}' not found in precompile array.  To ensure all components referred
         //     to by the RouterConfig are compiled, you must add '${componentName}' to the
         //     'precompile' array of your application component. This will be required in a future
         //     release of the router.`);
         factory = snapshot._resolvedComponentFactory;
     }
     var inj = core_1.ReflectiveInjector.fromResolvedProviders(providers, this.location.parentInjector);
     this.activated = this.location.createComponent(factory, this.location.length, inj, []);
     this.activated.changeDetectorRef.detectChanges();
 };
Exemplo n.º 21
0
 _initIfNeeded() {
     if (this._instantiated) {
         return;
     }
     if (!this._moduleFactory) {
         try {
             const moduleType = this._createCompilerAndModule();
             this._moduleFactory =
                 this._compiler.compileModuleAndAllComponentsSync(moduleType).ngModuleFactory;
         }
         catch (e) {
             if (getComponentType(e)) {
                 throw new Error(`This test module uses the component ${ɵstringify(getComponentType(e))} which is using a "templateUrl" or "styleUrls", but they were never compiled. ` +
                     `Please call "TestBed.compileComponents" before your test.`);
             }
             else {
                 throw e;
             }
         }
     }
     const ngZone = new NgZone({ enableLongStackTrace: true });
     const ngZoneInjector = ReflectiveInjector.resolveAndCreate([{ provide: NgZone, useValue: ngZone }], this.platform.injector);
     this._moduleRef = this._moduleFactory.create(ngZoneInjector);
     // ApplicationInitStatus.runInitializers() is marked @internal to core. So casting to any
     // before accessing it.
     this._moduleRef.injector.get(ApplicationInitStatus).runInitializers();
     this._instantiated = true;
 }
Exemplo n.º 22
0
 Bootloader.prototype.application = function (document, providers) {
     var doc = this.document(document);
     var pro = providers || this._config.providers;
     var customProviders = node_1.buildNodeAppProviders(doc, pro);
     var appinjector = core_1.ReflectiveInjector.resolveAndCreate(customProviders, this.platformRef.injector);
     return appinjector;
 };
Exemplo n.º 23
0
 ColorPickerDirective.prototype.openDialog = /**
  * @return {?}
  */
 function () {
     if (!this.dialogCreated) {
         /** @type {?} */
         var vcRef = this.vcRef;
         this.dialogCreated = true;
         if (this.cpUseRootViewContainer && this.cpDialogDisplay !== 'inline') {
             /** @type {?} */
             var classOfRootComponent = this.appRef.componentTypes[0];
             /** @type {?} */
             var appInstance = this.injector.get(classOfRootComponent);
             vcRef = appInstance.vcRef || appInstance.viewContainerRef || this.vcRef;
             if (vcRef === this.vcRef) {
                 console.warn('You are using cpUseRootViewContainer, ' +
                     'but the root component is not exposing viewContainerRef!' +
                     'Please expose it by adding \'public vcRef: ViewContainerRef\' to the constructor.');
             }
         }
         /** @type {?} */
         var compFactory = this.cfr.resolveComponentFactory(ColorPickerComponent);
         /** @type {?} */
         var injector = ReflectiveInjector.fromResolvedProviders([], vcRef.parentInjector);
         this.cmpRef = vcRef.createComponent(compFactory, 0, injector, []);
         this.cmpRef.instance.setupDialog(this, this.elRef, this.colorPicker, this.cpWidth, this.cpHeight, this.cpDialogDisplay, this.cpFallbackColor, this.cpColorMode, this.cpAlphaChannel, this.cpOutputFormat, this.cpDisableInput, this.cpIgnoredElements, this.cpSaveClickOutside, this.cpUseRootViewContainer, this.cpPosition, this.cpPositionOffset, this.cpPositionRelativeToArrow, this.cpPresetLabel, this.cpPresetColors, this.cpMaxPresetColorsLength, this.cpPresetEmptyMessage, this.cpPresetEmptyMessageClass, this.cpOKButton, this.cpOKButtonClass, this.cpOKButtonText, this.cpCancelButton, this.cpCancelButtonClass, this.cpCancelButtonText, this.cpAddColorButton, this.cpAddColorButtonClass, this.cpAddColorButtonText, this.cpRemoveColorButtonClass);
         this.dialog = this.cmpRef.instance;
         if (this.vcRef !== vcRef) {
             this.cmpRef.changeDetectorRef.detectChanges();
         }
     }
     else if (this.dialog) {
         this.dialog.openDialog(this.colorPicker);
     }
 };
Exemplo n.º 24
0
 RouterOutlet.prototype.activate = function (activatedRoute, loadedResolver, loadedInjector, providers, outletMap) {
     this.outletMap = outletMap;
     this._activatedRoute = activatedRoute;
     var snapshot = activatedRoute._futureSnapshot;
     var component = snapshot._routeConfig.component;
     var factory;
     try {
         if (typeof component === 'string') {
             factory = snapshot._resolvedComponentFactory;
         }
         else if (loadedResolver) {
             factory = loadedResolver.resolveComponentFactory(component);
         }
         else {
             factory = this.resolver.resolveComponentFactory(component);
         }
     }
     catch (e) {
         if (!(e instanceof core_1.NoComponentFactoryError))
             throw e;
         var componentName = component ? component.name : null;
         console.warn("'" + componentName + "' not found in entryComponents array.  To ensure all components referred\n          to by the Routes are compiled, you must add '" + componentName + "' to the\n          'entryComponents' array of your application component. This will be required in a future\n          release of the router.");
         factory = snapshot._resolvedComponentFactory;
     }
     var injector = loadedInjector ? loadedInjector : this.location.parentInjector;
     var inj = core_1.ReflectiveInjector.fromResolvedProviders(providers, injector);
     this.activated = this.location.createComponent(factory, this.location.length, inj, []);
     this.activated.changeDetectorRef.detectChanges();
     this.activateEvents.emit(this.activated.instance);
 };
Exemplo n.º 25
0
 ComponentsHelper.prototype.appendNextToRoot = function (ComponentClass, ComponentOptionsClass, options, contextInjector) {
     var location = this.getRootViewContainerRef(contextInjector);
     var providers = core_1.ReflectiveInjector.resolve([
         { provide: ComponentOptionsClass, useValue: options }
     ]);
     return this.appendNextToLocation(ComponentClass, location, providers);
 };
function bootstrapStatic(appComponentType, customProviders, initReflector) {
  if (lang_1.isPresent(initReflector)) {
    initReflector();
  }
  var appProviders = lang_1.isPresent(customProviders) ? [exports.BROWSER_APP_STATIC_PROVIDERS, customProviders] : exports.BROWSER_APP_STATIC_PROVIDERS;
  var appInjector = core_1.ReflectiveInjector.resolveAndCreate(appProviders, browserStaticPlatform().injector);
  return core_1.coreLoadAndBootstrap(appInjector, appComponentType);
}
Exemplo n.º 27
0
 _LoadSegments.prototype.loadNewSegment = function (outletMap, curr, prev, outlet) {
     var resolved = core_1.ReflectiveInjector.resolve([core_1.provide(RouterOutletMap, { useValue: outletMap }), core_1.provide(segments_1.RouteSegment, { useValue: curr })]);
     var ref = outlet.load(segments_1.routeSegmentComponentFactory(curr), resolved, outletMap);
     if (lifecycle_reflector_1.hasLifecycleHook("routerOnActivate", ref.instance)) {
         ref.instance.routerOnActivate(curr, prev, this.currTree, this.prevTree);
     }
     return ref.instance;
 };
Exemplo n.º 28
0
 NavControllerBase.prototype._viewInit = function (enteringView) {
     (void 0) /* assert */;
     (void 0) /* assert */;
     // render the entering view, and all child navs and views
     // entering view has not been initialized yet
     var /** @type {?} */ componentProviders = ReflectiveInjector.resolve([
         { provide: NavController, useValue: this },
         { provide: ViewController, useValue: enteringView },
         { provide: NavParams, useValue: enteringView.getNavParams() }
     ]);
     var /** @type {?} */ componentFactory = this._linker.resolveComponent(enteringView.component);
     var /** @type {?} */ childInjector = ReflectiveInjector.fromResolvedProviders(componentProviders, this._viewport.parentInjector);
     // create ComponentRef and set it to the entering view
     enteringView.init(componentFactory.create(childInjector, []));
     enteringView._state = STATE_INITIALIZED;
     this._preLoad(enteringView);
 };
Exemplo n.º 29
0
 ComponentsHelper.prototype.appendNextToLocation = function (ComponentClass, location, providers) {
     var componentFactory = this.componentFactoryResolver.resolveComponentFactory(ComponentClass);
     var parentInjector = location.parentInjector;
     var childInjector = parentInjector;
     if (providers && providers.length > 0) {
         childInjector = core_1.ReflectiveInjector.fromResolvedProviders(providers, parentInjector);
     }
     return location.createComponent(componentFactory, location.length, childInjector);
 };
Exemplo n.º 30
0
/**
 * Bootstrapping for Angular applications.
 *
 * You instantiate an Angular application by explicitly specifying a component to use
 * as the root component for your application via the `bootstrap()` method.
 *
 * ## Simple Example
 *
 * Assuming this `index.html`:
 *
 * ```html
 * <html>
 *   <!-- load Angular script tags here. -->
 *   <body>
 *     <my-src>loading...</my-src>
 *   </body>
 * </html>
 * ```
 *
 * An application is bootstrapped inside an existing browser DOM, typically `index.html`.
 * Unlike Angular 1, Angular 2 does not compile/process providers in `index.html`. This is
 * mainly for security reasons, as well as architectural changes in Angular 2. This means
 * that `index.html` can safely be processed using server-side technologies such as
 * providers. Bindings can thus use double-curly `{{ syntax }}` without collision from
 * Angular 2 component double-curly `{{ syntax }}`.
 *
 * We can use this script code:
 *
 * {@example core/ts/bootstrap/bootstrap.ts region='bootstrap'}
 *
 * When the src developer invokes `bootstrap()` with the root component `MyApp` as its
 * argument, Angular performs the following tasks:
 *
 *  1. It uses the component's `selector` property to locate the DOM element which needs
 *     to be upgraded into the angular component.
 *  2. It creates a new child injector (from the platform injector). Optionally, you can
 *     also override the injector configuration for an src by invoking `bootstrap` with the
 *     `componentInjectableBindings` argument.
 *  3. It creates a new `Zone` and connects it to the angular application's change detection
 *     domain instance.
 *  4. It creates an emulated or shadow DOM on the selected component's host element and loads the
 *     template into it.
 *  5. It instantiates the specified component.
 *  6. Finally, Angular performs change detection to apply the initial data providers for the
 *     application.
 *
 *
 * ## Bootstrapping Multiple Applications
 *
 * When working within a browser window, there are many singleton resources: cookies, title,
 * location, and others. Angular services that represent these resources must likewise be
 * shared across all Angular applications that occupy the same browser window. For this
 * reason, Angular creates exactly one global platform object which stores all shared
 * services, and each angular application injector has the platform injector as its parent.
 *
 * Each application has its own private injector as well. When there are multiple
 * applications on a page, Angular treats each application injector's services as private
 * to that application.
 *
 * ## API
 *
 * - `appComponentType`: The root component which should act as the application. This is
 *   a reference to a `Type` which is annotated with `@Component(...)`.
 * - `customProviders`: An additional set of providers that can be added to the
 *   src injector to override default injection behavior.
 *
 * Returns a `Promise` of {@link ComponentRef}.
 *
 * @experimental This api cannot be used with the offline compiler and thus is still subject to
 * change.
 */
function bootstrap(appComponentType, customProviders) {
    core_private_1.reflector.reflectionCapabilities = new core_private_1.ReflectionCapabilities();
    var providers = [
        platform_browser_1.BROWSER_APP_PROVIDERS, exports.BROWSER_APP_COMPILER_PROVIDERS,
        lang_1.isPresent(customProviders) ? customProviders : []
    ];
    var appInjector = core_1.ReflectiveInjector.resolveAndCreate(providers, platform_browser_1.browserPlatform().injector);
    return core_1.coreLoadAndBootstrap(appComponentType, appInjector);
}