Bootstrapping ng-metadata
ng-metadata provides @NgModule
from Angular 2 to Angular 1. To use @NgModule
, update your applicationbootstrap from angular.bootstrap
to the example below.
Bootstrap (bootstrap.ts)
import { platformBrowserDynamic } from 'ng-metadata/platform-browser-dynamic';
import { AppModule } from './app.module';
platformBrowserDynamic().bootstrapModule(AppModule);
App Module (app.module.ts)
import { NgModule } from 'ng-metadata/core';
import { AppComponent } from './app.component';
import { HeroComponent } from './hero.component';
import { HeroService } from './hero.service';
@NgModule({
declarations: [AppComponent, HeroComponent],
providers: [HeroService]
})
export class AppModule {}
原文: https://angular-2-training-book.rangle.io/handout/migrate/ng-metadata/bootstrap.html