I m learning Angular 2 internal components and behaviours, and I m having a problem while trying to display the metadata provided by the different decorators.
For example, I need to access the metadata provided by the NgModule annotation :
@NgModule({
declarations: [
/* ... */
],
imports: [
/* ... */
],
providers: [
/* ... */
],
bootstrap: [/* ... */]
})
export class AppModule { }
console.log(new AppModule());
Use reflect-metadata
.
npm install --save reflect-metadata
Then import it, and use it
import 'reflect-metadata'
let metadata = Reflect.getMetadata('annotations', AppModule)