104 lines
13 KiB
JavaScript
104 lines
13 KiB
JavaScript
'use strict';var angular_entrypoint_1 = require('angular2/src/core/angular_entrypoint');
|
|
exports.AngularEntrypoint = angular_entrypoint_1.AngularEntrypoint;
|
|
var browser_common_1 = require('angular2/src/platform/browser_common');
|
|
exports.BROWSER_PROVIDERS = browser_common_1.BROWSER_PROVIDERS;
|
|
exports.ELEMENT_PROBE_PROVIDERS = browser_common_1.ELEMENT_PROBE_PROVIDERS;
|
|
exports.ELEMENT_PROBE_PROVIDERS_PROD_MODE = browser_common_1.ELEMENT_PROBE_PROVIDERS_PROD_MODE;
|
|
exports.inspectNativeElement = browser_common_1.inspectNativeElement;
|
|
exports.BrowserDomAdapter = browser_common_1.BrowserDomAdapter;
|
|
exports.By = browser_common_1.By;
|
|
exports.Title = browser_common_1.Title;
|
|
exports.DOCUMENT = browser_common_1.DOCUMENT;
|
|
exports.enableDebugTools = browser_common_1.enableDebugTools;
|
|
exports.disableDebugTools = browser_common_1.disableDebugTools;
|
|
var lang_1 = require('angular2/src/facade/lang');
|
|
var browser_common_2 = require('angular2/src/platform/browser_common');
|
|
var compiler_1 = require('angular2/compiler');
|
|
var core_1 = require('angular2/core');
|
|
var reflection_capabilities_1 = require('angular2/src/core/reflection/reflection_capabilities');
|
|
var xhr_impl_1 = require("angular2/src/platform/browser/xhr_impl");
|
|
var compiler_2 = require('angular2/compiler');
|
|
var di_1 = require('angular2/src/core/di');
|
|
/**
|
|
* An array of providers that should be passed into `application()` when bootstrapping a component.
|
|
*/
|
|
exports.BROWSER_APP_PROVIDERS = lang_1.CONST_EXPR([
|
|
browser_common_2.BROWSER_APP_COMMON_PROVIDERS,
|
|
compiler_1.COMPILER_PROVIDERS,
|
|
new di_1.Provider(compiler_2.XHR, { useClass: xhr_impl_1.XHRImpl }),
|
|
]);
|
|
/**
|
|
* 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-app>loading...</my-app>
|
|
* </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 app 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 app 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
|
|
* app injector to override default injection behavior.
|
|
*
|
|
* Returns a `Promise` of {@link ComponentRef}.
|
|
*/
|
|
function bootstrap(appComponentType, customProviders) {
|
|
core_1.reflector.reflectionCapabilities = new reflection_capabilities_1.ReflectionCapabilities();
|
|
var appProviders = lang_1.isPresent(customProviders) ? [exports.BROWSER_APP_PROVIDERS, customProviders] : exports.BROWSER_APP_PROVIDERS;
|
|
return core_1.platform(browser_common_2.BROWSER_PROVIDERS).application(appProviders).bootstrap(appComponentType);
|
|
}
|
|
exports.bootstrap = bootstrap;
|
|
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiYnJvd3Nlci5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbImFuZ3VsYXIyL3BsYXRmb3JtL2Jyb3dzZXIudHMiXSwibmFtZXMiOlsiYm9vdHN0cmFwIl0sIm1hcHBpbmdzIjoiQUFBQSxtQ0FBZ0Msc0NBQXNDLENBQUM7QUFBL0QsbUVBQStEO0FBQ3ZFLCtCQVdPLHNDQUFzQyxDQUFDO0FBVjVDLCtEQUFpQjtBQUNqQiwyRUFBdUI7QUFDdkIsK0ZBQWlDO0FBQ2pDLHFFQUFvQjtBQUNwQiwrREFBaUI7QUFDakIsaUNBQUU7QUFDRix1Q0FBSztBQUNMLDZDQUFRO0FBQ1IsNkRBQWdCO0FBQ2hCLCtEQUM0QztBQUU5QyxxQkFBMEMsMEJBQTBCLENBQUMsQ0FBQTtBQUNyRSwrQkFHTyxzQ0FBc0MsQ0FBQyxDQUFBO0FBQzlDLHlCQUFpQyxtQkFBbUIsQ0FBQyxDQUFBO0FBQ3JELHFCQUFnRCxlQUFlLENBQUMsQ0FBQTtBQUNoRSx3Q0FBcUMsc0RBQXNELENBQUMsQ0FBQTtBQUM1Rix5QkFBc0Isd0NBQXdDLENBQUMsQ0FBQTt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