Hi 

I have recently started working on angular4  and here is my requirement. 
I have two modules A and main App Module. 

I want to include module A depending upon some condition into main App 
Module. 

In @NgModule decorator under imports array i can easily specify which 
modules to be included. but i want the conditional inclusion.

Is there any way by which in main App module class i can access the 
decorator metadata imports and push the module depending upon the condition 
?


I am expecting something like as explain below.

@NgModule({
declarations: [
AppComponent,
UsersListComponent
],
imports: [
BrowserModule,
AmdBridgeModule, // conditionally should be included
RouterModule.forRoot(routes)
],
providers: [],
bootstrap: [AppComponent]
})
export class AppModule { 
constructor (){
if(condition){
this.metadata.imports.push("AmdBridgeModule");
}
}

}







-- 
You received this message because you are subscribed to the Google Groups 
"Angular and AngularJS discussion" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/angular.
For more options, visit https://groups.google.com/d/optout.

Reply via email to