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


TypeScript browser.bootstrap函數代碼示例

本文整理匯總了TypeScript中angular2/platform/browser.bootstrap函數的典型用法代碼示例。如果您正苦於以下問題:TypeScript bootstrap函數的具體用法?TypeScript bootstrap怎麽用?TypeScript bootstrap使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。


在下文中一共展示了bootstrap函數的10個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。

示例1: constructor

import {bootstrap}    from 'angular2/platform/browser';     //for bootstraping
import {Component} from 'angular2/core';                    //for components

import {SampleService} from './sampleService';          //import service

@Component({
    selector: 'main-selector',
    template: `<br/> <h3>Main Component</h3>
                <ul><li *ngFor="#v of myList">{{v}}</li></ul>`,
    providers: [SampleService]
})
export class MainComponent {
    myList: string[];
    
    constructor(public myService: SampleService) {
            this.myList = myService.getSampleData();  
    } 
    
}



bootstrap(MainComponent);
開發者ID:shazy655,項目名稱:ng2,代碼行數:23,代碼來源:main.ts

示例2: enableProdMode

import {bootstrap}    from 'angular2/platform/browser';
import {enableProdMode} from 'angular2/core';
import {ROUTER_PROVIDERS} from 'angular2/router';
import {HTTP_PROVIDERS} from 'angular2/http';
import {BackendService} from './app/services/backend';
import {MainComponent} from './app/main';

if ('development' !== process.env.ENV) {
  enableProdMode();
}

bootstrap(MainComponent, [ROUTER_PROVIDERS, HTTP_PROVIDERS, BackendService]);
開發者ID:rodrigouroz,項目名稱:angular2-presentation,代碼行數:12,代碼來源:bootstrap.ts

示例3: bootstrap

import {bootstrap} from 'angular2/platform/browser';
import {AppComponent} from './app.component';

bootstrap (AppComponent)
.then (success => console.log('Bootstrap successfully!'))
.catch(err => console.log(err));
開發者ID:laudrup69,項目名稱:Angular2,代碼行數:6,代碼來源:boot.ts

示例4: bootstrap

import {bootstrap} from 'angular2/platform/browser'
import {Component} from 'angular2/core';
import {TodoService} from "./todo/services/todo-service";
import {TodoInput} from './todo/components/todo-input';
import {TodoList} from "./todo/components/todo-list";
import {StatusSelector} from "./todo/components/status-selector";
import {SearchBox} from "./todo/components/search-box";

@Component({
  selector: 'todo-app',
  directives: [TodoInput, TodoList, StatusSelector, SearchBox],
  template: `<div>
    <search-box (update)="term = $event"></search-box>
    <todo-input></todo-input>
    <status-selector (select)="status = $event"></status-selector>
    <todo-list [status]="status" [term]="term"></todo-list>
  </div>`
})
class TodoApp{}
bootstrap(TodoApp, [TodoService]);
開發者ID:DotHide,項目名稱:angular2-quickstart,代碼行數:20,代碼來源:main.ts

示例5: bootstrap

import {bootstrap} from 'angular2/platform/browser';
import {AppComponent} from './app/app.component';
import {ROUTER_PROVIDERS} from 'angular2/router';
// import {enableProdMode} from 'angular2/core';

bootstrap(AppComponent, [
  ROUTER_PROVIDERS
]);

// enableProdMode();
開發者ID:beeva-miguelsarries,項目名稱:angular2-cli,代碼行數:10,代碼來源:bootstrap.ts

示例6: bootstrap

import {bootstrap}    from 'angular2/platform/browser';
import {AppComponent} from './app.component';
import {HeroService}  from './heroes/hero.service';

//#docregion bootstrap
// Injecting services in bootstrap works but is discouraged
bootstrap(AppComponent, [HeroService]);
//#enddocregion bootstrap
開發者ID:austinglenn,項目名稱:angular.io,代碼行數:8,代碼來源:main.1.ts

示例7: constructor

import {AUTH_PROVIDERS} from 'angular2-jwt';

import {Home} from './home.component';
import {Ping} from './ping.component';
import {Profile} from './profile.component';
import {Auth} from './auth.service';

@Component({
  selector: 'app',
  providers: [ Auth ],
  directives: [ ROUTER_DIRECTIVES ],
  templateUrl: 'src/app.template.html',
  styles: [`.btn-margin { margin-top: 5px}`]
})
@RouteConfig([
  { path: '/home',  name: 'Home',  component: Home, useAsDefault: true },
  { path: '/ping',  name: 'Ping',  component: Ping },
  { path: '/profile',  name: 'Profile',  component: Profile }
])
export class App {

  constructor(private auth: Auth) {}

}

bootstrap(App, [
  HTTP_PROVIDERS,
  ROUTER_PROVIDERS,
  AUTH_PROVIDERS,
  provide(LocationStrategy, { useClass: HashLocationStrategy })
])
開發者ID:christiannwamba,項目名稱:auth0-angular2,代碼行數:31,代碼來源:app.component.ts

示例8: bootstrap

import {bootstrap} from 'angular2/platform/browser';
import {ROUTER_PROVIDERS} from 'angular2/router';
import {HeroService} from './hero.service';
import {AppComponent} from './app.component';

bootstrap(AppComponent, [
  ROUTER_PROVIDERS,
  HeroService
]);



/*
Copyright 2016 Google Inc. All Rights Reserved.
Use of this source code is governed by an MIT-style license that
can be found in the LICENSE file at http://angular.io/license
*/
開發者ID:julianlopezv,項目名稱:AngularJS,代碼行數:17,代碼來源:main.ts

示例9: bootstrap

import {bootstrap} from 'angular2/platform/browser';
import {AppComponent} from "./app.component";
import {HTTP_PROVIDERS} from "angular2/http";
import {WeatherService} from './weather/weather.service';

bootstrap(AppComponent, [HTTP_PROVIDERS, WeatherService]);
開發者ID:Radeg,項目名稱:a2-weather-app,代碼行數:6,代碼來源:boot.ts

示例10: bootstrap

ďťżimport { bootstrap } from "angular2/platform/browser";
import { MyApp } from "./app";
bootstrap(MyApp);
開發者ID:volyasmith,項目名稱:dating_site,代碼行數:3,代碼來源:main.ts


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