Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/angular/29.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Angular 如何在子模块中定义条目组件?_Angular_Angular2 Modules - Fatal编程技术网

Angular 如何在子模块中定义条目组件?

Angular 如何在子模块中定义条目组件?,angular,angular2-modules,Angular,Angular2 Modules,我想在用户子模块中设置entry组件。它不起作用。但是,当我在父应用程序模块中设置它时,它工作正常。为什么 //User module @NgModule({ imports: [], exports: [UsersFormsComponent], declarations: [UsersFormsComponent], providers: [], entryComponents : { UsersFormsComponent } }) export class UsersModule {

我想在用户子模块中设置entry组件。它不起作用。但是,当我在父应用程序模块中设置它时,它工作正常。为什么

//User module
@NgModule({
imports: [],
exports: [UsersFormsComponent],
declarations: [UsersFormsComponent],
providers: [],
entryComponents : {
 UsersFormsComponent
}
})
export class UsersModule { }

// app module
@NgModule({
imports: [UsersModule],
exports: [],
declarations: [AppComponent],
providers: [],
})
export class AppModule { }

把你的问题弄清楚。您的意思是上述代码有效或失败使您的问题更加清楚。您的意思是,上面的代码可以工作,也可以失败