本文整理汇总了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);