[英]Is it possible (and how) to access the declarations array inside NgModule in app.module in another class?
I want to get the declarations array from NgModule in app.module in another class. 我想从另一个类的app.module中的NgModule获取声明数组。 Is this possible?
这可能吗?
@NgModule({
declarations: [
AppComponent,
UserListingComponent,
NewUserComponent,
],
I expect something like: const compArray = NgModule.declarations 我希望类似于:const compArray = NgModule.declarations
Maybe you can do this way 也许你可以这样做
export declarationsArray = [
AppComponent,
UserListingComponent,
NewUserComponent,
]
@NgModule({
declarations: declarationsArray,
})
Then you can import in your component or service like 然后,您可以导入您的组件或服务
let deArray = declarationsArray
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.