當前位置: 首頁>>代碼示例>>TypeScript>>正文


TypeScript bootstrap.bootstrap函數代碼示例

本文整理匯總了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();
        });
      });
}
開發者ID:goderbauer,項目名稱:angular,代碼行數:34,代碼來源:index.ts

示例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);
}
開發者ID:fuzolan,項目名稱:angular2-meteor-client,代碼行數:8,代碼來源:bootstrap.ts

示例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);
}
開發者ID:goderbauer,項目名稱:angular,代碼行數:10,代碼來源:index.ts

示例4: main

export function main() {
  return bootstrap(App, [
    FORM_PROVIDERS,
    ROUTER_PROVIDERS,
    HTTP_PROVIDERS,
    ELEMENT_PROBE_PROVIDERS,

    APP_PROVIDERS,
  ]).catch(e => console.error(e));
}
開發者ID:windwang,項目名稱:angular2-app,代碼行數:10,代碼來源:bootstrap.ts

示例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));
});
開發者ID:ishara,項目名稱:angular2-app,代碼行數:11,代碼來源:main.ts

示例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();
                 });
               });
         }));
開發者ID:,項目名稱:,代碼行數:21,代碼來源:

示例7: main

export function main() {
  reflector.reflectionCapabilities = new ReflectionCapabilities();
  bootstrap(InboxApp,
            [ROUTER_PROVIDERS, provide(LocationStrategy, {useClass: HashLocationStrategy})]);
}
開發者ID:TedSander,項目名稱:angular,代碼行數:5,代碼來源:index.ts

示例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);
開發者ID:molliecool,項目名稱:NeuralNet,代碼行數:25,代碼來源:app.ts

示例9: main

export function main() {
  commonDemoSetup();
  bootstrap(DemoApp, [provide(UrlResolver, {useValue: new DemoUrlResolver()})]);
}
開發者ID:ASLA1899,項目名稱:angular,代碼行數:4,代碼來源:index.ts

示例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) ]);
開發者ID:AbdellaToronto,項目名稱:angular2-redux-starter,代碼行數:13,代碼來源:index.ts


注:本文中的angular2/bootstrap.bootstrap函數示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。