首页 > 解决方案 > 如何在功能模块组件中使用material2-carousel

问题描述

我正在使用 Angular 7,并尝试使用材料轮播(https://github.com/gbrlsnchs/material2-carousel)。

我在我的功能模块中使用它时遇到问题。

1)我试图在主模块中导入它:

import { MatCarouselModule } from '@ngmodule/material-carousel';
@NgModule({
  imports: [
    MatCarouselModule.forRoot()
  ]

2)我尝试以与上述相同的方式将其导入到我的共享材料模块中,我在所有功能模块中都导入了该模块。

3)我尝试导入主模块和共享模块。

这三种解决方案中的任何一种都不起作用。

我总是得到错误:

ERROR Error: Uncaught (in promise): Error: Template parse errors:
'mat-carousel-slide' is not a known element:
1. If 'mat-carousel-slide' is an Angular component, then verify that it is part of this module.
2. If 'mat-carousel-slide' is a Web Component then add 'CUSTOM_ELEMENTS_SCHEMA' to the '@NgModule.schemas' of this component to suppress this message. ("
        </div>
      <mat-carousel>
        [ERROR ->]<mat-carousel-slide>
            1
          </mat-carousel-slide>
"): ng:///EditorModule/ImageDisplayComponent.html@41:

请问有什么建议吗?

标签: javascriptangular

解决方案


推荐阅读