Bootstrapping ng-metadata

ng-metadata provides @NgModulefrom Angular 2 to Angular 1. To use @NgModule, update your applicationbootstrap from angular.bootstrap to the example below.

Bootstrap (bootstrap.ts)

  1. import { platformBrowserDynamic } from 'ng-metadata/platform-browser-dynamic';
  2. import { AppModule } from './app.module';
  3. platformBrowserDynamic().bootstrapModule(AppModule);

App Module (app.module.ts)

  1. import { NgModule } from 'ng-metadata/core';
  2. import { AppComponent } from './app.component';
  3. import { HeroComponent } from './hero.component';
  4. import { HeroService } from './hero.service';
  5. @NgModule({
  6. declarations: [AppComponent, HeroComponent],
  7. providers: [HeroService]
  8. })
  9. export class AppModule {}

原文: https://angular-2-training-book.rangle.io/handout/migrate/ng-metadata/bootstrap.html