Below is my initial code to create dynamic module:
protected createComponentModule(componentType: any) {
@NgModule({
imports: [
ComponentModule
],
declarations: [
componentType
],
})
class RuntimeComponentModule {
}
return RuntimeComponentModule;
}
While I am going to implement AOT on below code it throw me error:
No NgModule metadata found for 'RuntimeComponentModule'
I found solution of it some Articals by change below code and my error gone away:
default class RuntimeComponentModule
{
}
But new error is raised it say:
Modifiers cannot appear here
It not allowed me to decorate @NgModule within method.