Get reference to injector inside Angular 2.X custom module?

1k views Asked by At

How we can get a reference to dependency injector inside the application module ?

Here is the example code of the custom module. So how we can get reference to Angular DI (Dependency Injector) inside this class ?

@NgModule({
  declarations: [
    MyApplication,
  ],
  imports: [
    BrowserModule,
    FormsModule,
    HttpModule
  ],
  providers: [],
  bootstrap: [MyApplication]
})
export class MyApplicationModule {
  constructor() {

  }

}
1

There are 1 answers

2
AudioBubble On BEST ANSWER

You mean this ?

export class MyApplicationModule {
  constructor(private injector: Injector) {}
}