本文整理匯總了TypeScript中angular2/bootstrap.bootstrap函數的典型用法代碼示例。如果您正苦於以下問題:TypeScript bootstrap函數的具體用法?TypeScript bootstrap怎麽用?TypeScript bootstrap使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。
在下文中一共展示了bootstrap函數的10個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。
示例1: main
export function main() {
var size = getIntParameter('size');
testList = ListWrapper.createFixedSize(size);
bootstrap(AppComponent)
.then((ref) => {
var injector = ref.injector;
var app: AppComponent = ref.hostComponent;
var lifeCycle = injector.get(LifeCycle);
bindAction('#reset', function() {
app.reset();
lifeCycle.tick();
});
// Baseline (plain components)
bindAction('#createPlainComponents', function() {
app.createPlainComponents();
lifeCycle.tick();
});
// Components with decorators
bindAction('#createComponentsWithDirectives', function() {
app.createComponentsWithDirectives();
lifeCycle.tick();
});
// Components with decorators
bindAction('#createDynamicComponents', function() {
app.createDynamicComponents();
lifeCycle.tick();
});
});
}
示例2: bootstrap
export function bootstrap(appComponentType: any,
providers: Array<Type | Provider | any[]> = null) {
const bootstrapProviders = MeteorProviders;
if (providers) {
providers.forEach((element) => bootstrapProviders.push(element));
}
ng2Bootstrap(appComponentType, providers);
}
示例3: main
export function main() {
// Bootstrapping only requires specifying a root component.
// The boundary between the Angular application and the rest of the page is
// the shadowDom of this root component.
// The selector of the component passed in is used to find where to insert the
// application.
// You can use the light dom of the <hello-app> tag as temporary content (for
// example 'Loading...') before the application is ready.
bootstrap(HelloCmp);
}
示例4: main
export function main() {
return bootstrap(App, [
FORM_PROVIDERS,
ROUTER_PROVIDERS,
HTTP_PROVIDERS,
ELEMENT_PROBE_PROVIDERS,
APP_PROVIDERS,
]).catch(e => console.error(e));
}
示例5: bootstrap
document.addEventListener('DOMContentLoaded', () => {
bootstrap(App, [
...FORM_PROVIDERS,
...ROUTER_PROVIDERS,
...HTTP_PROVIDERS,
...ENV_PROVIDERS,
...APP_PROVIDERS,
]).then((appRef:ComponentRef) => {
appInjector(appRef.injector);
}).catch(e => console.error(e));
});
示例6: it
it('should bootstrap a simple app', inject([AsyncTestCompleter], (async) => {
var fakeDoc = DOM.createHtmlDocument();
var el = DOM.createElement('app-cmp', fakeDoc);
DOM.appendChild(fakeDoc.body, el);
bootstrap(AppCmp,
[
ROUTER_PROVIDERS,
provide(ROUTER_PRIMARY_COMPONENT, {useValue: AppCmp}),
provide(LocationStrategy, {useClass: MockLocationStrategy}),
provide(DOCUMENT, {useValue: fakeDoc})
])
.then((applicationRef) => {
var router = applicationRef.hostComponent.router;
router.subscribe((_) => {
expect(el).toHaveText('outer { hello }');
expect(applicationRef.hostComponent.location.path()).toEqual('');
async.done();
});
});
}));
示例7: main
export function main() {
reflector.reflectionCapabilities = new ReflectionCapabilities();
bootstrap(InboxApp,
[ROUTER_PROVIDERS, provide(LocationStrategy, {useClass: HashLocationStrategy})]);
}
示例8: function
"use strict";
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
return c > 3 && r && Object.defineProperty(target, key, r), r;
};
var __metadata = (this && this.__metadata) || function (k, v) {
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
};
var angular2_1 = require('angular2/angular2');
var bootstrap_1 = require('angular2/bootstrap');
var NeuralNet = (function () {
function NeuralNet() {
}
NeuralNet = __decorate([
angular2_1.Component({
selector: 'neuralnet',
template: 'hello world again'
}),
__metadata('design:paramtypes', [])
], NeuralNet);
return NeuralNet;
}());
bootstrap_1.bootstrap(NeuralNet);
示例9: main
export function main() {
commonDemoSetup();
bootstrap(DemoApp, [provide(UrlResolver, {useValue: new DemoUrlResolver()})]);
}
示例10: require
import {Component, View, Inject, enableProdMode} from 'angular2/core';
import {bootstrap} from 'angular2/bootstrap';
import configureStore from './store/configure-store';
import App from './containers/app';
const provider = require('ng2-redux').provider;
const store = configureStore();
declare let __PRODUCTION__: any;
if (__PRODUCTION__) {
enableProdMode();
}
bootstrap(App, [ provider(store) ]);