Angular entryComponents在角度6下不工作
在angular 6中使用ng引导模式时出现问题 首先,我有两个模块:Angular entryComponents在角度6下不工作,angular,Angular,在angular 6中使用ng引导模式时出现问题 首先,我有两个模块: AppModule和ComponentModule 下面是组件模块: @NgModule({ 进口:[ 公共模块, FormsModule, 组件路由模块, BsDropdownModule.forRoot(), 塔布斯穆勒, PaginationModule.forRoot(), PopoverModule.forRoot(), ProgressbarModule.forRoot(), ToolTimpModule.for
AppModule
和ComponentModule
下面是组件模块:
@NgModule({
进口:[
公共模块,
FormsModule,
组件路由模块,
BsDropdownModule.forRoot(),
塔布斯穆勒,
PaginationModule.forRoot(),
PopoverModule.forRoot(),
ProgressbarModule.forRoot(),
ToolTimpModule.forRoot(),
ModalModule.forRoot(),
NgMultiSelectDropDownModule.forRoot(),
],
声明:[
类别成分,
CourseComponent,
模态分量,
类别组件,
],
entryComponents:[CategoryModalComponent],
})
导出类组件模块{}
ComponentModule
是我放置组件的地方,在我登录后将显示该组件
在组件模块中,我有一个课程组件:
@组件({
选择器:“应用程序课程”,
模板:'
根据错误,我在ComponentModule
中添加了它,但它不工作
您能给出一些建议来解决这个问题吗?将NgbModalModule或NgbModule添加到您的组件模块中
组件模块中没有ngb模块
nb:在你的案件中尝试过并发挥了作用
import { NgbModalModule } from '@ng-bootstrap/ng-bootstrap';
@NgModule({
imports: [
...
NgbModalModule
],
...
})
export class ComponentModule { }
将NgbModalModule或NgbModule添加到组件模块
组件模块中没有ngb模块
nb:在你的案件中尝试过并发挥了作用
import { NgbModalModule } from '@ng-bootstrap/ng-bootstrap';
@NgModule({
imports: [
...
NgbModalModule
],
...
})
export class ComponentModule { }
您应该添加'CategoryModalComponent'作为模块中的声明和entryComponent
您应该添加“CategoryModalComponent”作为模块中的声明和入口组件
等等,我已经在ModalComponent中导入了NgbModalModule。为什么要在ComponentModule中导入模块?ComponentModule是所有模态组件和类别组件的父模块。我们将模块导入父模块,以便在该模块中的所有组件中使用它。为什么要在组件中导入模块?Beca按Alt+Enter键时使用,WebStorm会自动生成组件的导入语句:)))))但是等等,我已经在ModalComponent中导入了NgbModalModule。为什么我要在ComponentModule中导入模块?ComponentModule是所有模态组件和分类组件的父模块。我们将模块导入父模块,以便可以在该模块中的所有组件中使用它。为什么要在组件中导入模块?因为当我按Alt+Enter时,WebStorm自动生成组件的导入语句:“щщ”))将其添加到声明中,即使它已添加到entryComponents,这也是将其添加到声明中的关键,即使它已添加到entryComponents,这对我来说也是关键