angular-cn/public/docs/_examples/cb-dependency-injection/ts/app/main.ts

26 lines
845 B
TypeScript
Raw Normal View History

2016-03-26 12:18:13 -04:00
// #docregion
import { bootstrap } from 'angular2/platform/browser';
import { provide } from 'angular2/core';
import { XHRBackend } from 'angular2/http';
import { LocationStrategy,
HashLocationStrategy,
ROUTER_PROVIDERS } from 'angular2/router';
import { HeroData } from './hero-data';
import { InMemoryBackendService,
SEED_DATA } from 'a2-in-memory-web-api/core';
import { AppComponent } from './app.component';
// #docregion bootstrap
bootstrap(AppComponent, [
ROUTER_PROVIDERS,
provide(LocationStrategy,
{useClass: HashLocationStrategy}),
provide(XHRBackend, { useClass: InMemoryBackendService }), // in-mem server
provide(SEED_DATA, { useClass: HeroData }) // in-mem server data
]).catch((err: any) => console.error(err));
// #enddocregion bootstrap