Reputation: 1212
As I understood now I should use modules for bootstrapping. But now I couldn't understand how should I provide custom providers?
Example from RC 4:
bootstrap(
....
{
provide : Router,
useClass: SomeClass
},
{
provide : API_URL,
useValue: "awesome url"
},
{
provide : AUTH_URL,
useValue: "other awesome url"
}
)
How can I pass this params in new bootstrapping system?
Upvotes: 0
Views: 66
Reputation: 8099
In the AppModule
:
@NgModule({
imports: [
BrowserModule,
FormsModule,
routing,
HttpModule
],
declarations: [
AppComponent,
HeroesComponent,
DashboardComponent,
HeroDetailComponent,
HeroSearchComponent
],
providers: [ // <=== THIS
HeroService,
{ provide: XHRBackend, useClass: InMemoryBackendService }, // in-mem server
{ provide: SEED_DATA, useClass: InMemoryDataService } // in-mem server data
],
bootstrap: [ AppComponent ]
})
export class AppModule {
}
where providers
specify custom providers
Check updated Tour of Heroes https://angular.io/resources/live-examples/toh-6/ts/plnkr.html
Upvotes: 1