5
因爲我有角2 RC4以下main.ts文件:角2 RC4到RC5引導
import { bootstrap } from '@angular/platform-browser-dynamic';
import { enableProdMode,provide } from '@angular/core';
import {disableDeprecatedForms, provideForms} from '@angular/forms';
import {RequestOptions,HTTP_PROVIDERS} from '@angular/http';
import { AppComponent, environment } from './app/';
import { appRouterProviders } from './app/app.routes';
import {CustomRequestOptions} from "./app/custom-request-options";
import { Title } from '@angular/platform-browser';
if (environment.production) {
enableProdMode();
}
bootstrap(AppComponent, [
appRouterProviders,
disableDeprecatedForms(),
provideForms(),
HTTP_PROVIDERS,
provide(RequestOptions, {useClass: CustomRequestOptions}),
Title
])
.catch(err => console.error(err));
現在..我需要它作爲一個模塊。所以我創建app.module.ts
文件
import { NgModule } from '@angular/core';
import { BrowserModule } from '@angular/platform-browser';
import { AppComponent } from './app.component';
@NgModule({
declarations: [AppComponent],
imports: [BrowserModule],
bootstrap: [AppComponent],
})
export class AppModule {}
如何導入我的所有供應商和declrations從以下線路:
bootstrap(AppComponent, [
appRouterProviders,
disableDeprecatedForms(),
provideForms(),
HTTP_PROVIDERS,
provide(RequestOptions, {useClass: CustomRequestOptions}),
Title
])
到模塊中的工作嗎?
您好亨利,可惜你上面分享的鏈接斷開。我有個問題。 ''platformBrowserDynamic()。bootstrapModule()'return'Promise'?在Angular2加載'AppModule'之後,我們可以做一些特定於App的引導工作嗎? – sanbhat