本文整理匯總了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);
示例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]);
示例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));
示例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]);
示例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();
示例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
示例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 })
])
示例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
*/
示例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]);
示例10: bootstrap
ďťżimport { bootstrap } from "angular2/platform/browser";
import { MyApp } from "./app";
bootstrap(MyApp);