未找到Angular 2.2.0 platform-b​​rowser-dynamic bootstrap

Rom*_*Kap 3 javascript css angular-ui-bootstrap angular

我习惯用plattform-b​​rowser-dynamic 2.0.0导入bootstrap,如下所示:

import { bootstrap } from '@angular/platform-browser-dynamic/';
Run Code Online (Sandbox Code Playgroud)

现在我创建新的Projekt并使用角度版本2.2.0 Plattform-b​​rowser-dynamic packages具有版本2.2.0:

 "@angular/common": "~2.2.0",
    "@angular/compiler": "~2.2.0",
    "@angular/core": "~2.2.0",
    "@angular/forms": "~2.2.0",
    "@angular/http": "~2.2.0",
    "@angular/platform-browser": "~2.2.0",
    "@angular/platform-browser-dynamic": "~2.2.0",
    "@angular/router": "~3.2.0",
    "@angular/upgrade": "~2.2.0",
    "angular-in-memory-web-api": "~0.1.15"
Run Code Online (Sandbox Code Playgroud)

我尝试使用包2.0.0导入bootstrap,但是找不到它.我的代码:

import { bootstrap } from '@angular/platform-browser-dynamic/*';
import {AppComponent} from "./app.component";
bootstrap(AppComponent);
Run Code Online (Sandbox Code Playgroud)

错误:

错误TS2305:模块'"../ node_modules/@angular/platform-b​​rowser-dynamic/index"'没有导出成员'bootstrap'.

我该如何解决这个问题?我找不到类似的lib.

Pan*_*kar 5

根据角度最终版本,您可以bootstrap使用应用程序模块platformbrowserbootstrapModule方法.另外,您需要为您的应用程序创建自己的模块.

app.module.ts

import { NgModule }      from '@angular/core';
import { BrowserModule } from '@angular/platform-browser';

import { AppComponent }   from './app.component';

@NgModule({
  imports:      [ BrowserModule ],
  declarations: [ AppComponent ],
  bootstrap:    [ AppComponent ]
})
export class AppModule { }
Run Code Online (Sandbox Code Playgroud)

main.ts

import { platformBrowserDynamic } from '@angular/platform-browser-dynamic';
import { AppModule } from './app.module';

platformBrowserDynamic().bootstrapModule(AppModule);
Run Code Online (Sandbox Code Playgroud)

Plunkr演示