如何解决 'mdb-accordion' 不是已知元素:Angular 应用程序中的错误?
How to resolve 'mdb-accordion' is not a known element: error in Angular app?
我正在尝试使用 this 示例将 Material 设计 Bootstrap 手风琴添加到我的 angular 应用程序。
这是我的 HTML:
<mdb-accordion [multiple]="false">
<mdb-accordion-item [collapsed]="false">
<mdb-accordion-item-head>Collapsible Group Item #1</mdb-accordion-item-head>
<mdb-accordion-item-body>
Anim pariatur cliche reprehenderit, enim eiusmod high life accusamus terry richardson ad squid. 3 wolf moon officia aute,
aliqua put a bird on it squid single-origin coffee nulla assumenda shoreditch et. Nihil anim keffiyeh helvetica, craft
</mdb-accordion-item-body>
</mdb-accordion-item>
</mdb-accordion>
这是我收到的错误消息:
'mdb-accordion' is not a known element:
If 'mdb-accordion' is an Angular component, then verify that it is part of this module.
If 'mdb-accordion' is a Web Component then add 'CUSTOM_ELEMENTS_SCHEMA' to the '@NgModule.schemas' of this component to suppress this message.ng(0)
这是我 Angular.json 中的内容:
"styles": [
"node_modules/@fortawesome/fontawesome-free/scss/fontawesome.scss",
"node_modules/@fortawesome/fontawesome-free/scss/solid.scss",
"node_modules/@fortawesome/fontawesome-free/scss/regular.scss",
"node_modules/@fortawesome/fontawesome-free/scss/brands.scss",
"node_modules/angular-bootstrap-md/assets/scss/bootstrap/bootstrap.scss",
"node_modules/angular-bootstrap-md/assets/scss/mdb.scss",
"./node_modules/quill/dist/quill.core.css",
"./node_modules/quill/dist/quill.snow.css",
"node_modules/animate.css/animate.css",
"src/styles.css"
],
"scripts": [
"node_modules/chart.js/dist/Chart.js",
"node_modules/hammerjs/hammer.min.js",
"./node_modules/quill/dist/quill.js"
]
我的应用程序模块中有以下内容:
import { MDBBootstrapModule } from 'angular-bootstrap-md';
@NgModule({
imports: [
MDBBootstrapModule.forRoot(),
],
})
export class AppModule { }
我尝试将 MDBootstrapAccordion 之类的内容添加到应用程序模块的导入中,但没有出现任何内容。
有人可以告诉我手风琴显示缺少什么吗?
您使用 MDB Free,mdb-accordion
在此版本中不可用。您需要购买 PRO 版本才能在您的项目中使用它。
如您所见,文档中有一个'MDB Pro component'标签:
我正在尝试使用 this 示例将 Material 设计 Bootstrap 手风琴添加到我的 angular 应用程序。
这是我的 HTML:
<mdb-accordion [multiple]="false">
<mdb-accordion-item [collapsed]="false">
<mdb-accordion-item-head>Collapsible Group Item #1</mdb-accordion-item-head>
<mdb-accordion-item-body>
Anim pariatur cliche reprehenderit, enim eiusmod high life accusamus terry richardson ad squid. 3 wolf moon officia aute,
aliqua put a bird on it squid single-origin coffee nulla assumenda shoreditch et. Nihil anim keffiyeh helvetica, craft
</mdb-accordion-item-body>
</mdb-accordion-item>
</mdb-accordion>
这是我收到的错误消息:
'mdb-accordion' is not a known element:
If 'mdb-accordion' is an Angular component, then verify that it is part of this module.
If 'mdb-accordion' is a Web Component then add 'CUSTOM_ELEMENTS_SCHEMA' to the '@NgModule.schemas' of this component to suppress this message.ng(0)
这是我 Angular.json 中的内容:
"styles": [
"node_modules/@fortawesome/fontawesome-free/scss/fontawesome.scss",
"node_modules/@fortawesome/fontawesome-free/scss/solid.scss",
"node_modules/@fortawesome/fontawesome-free/scss/regular.scss",
"node_modules/@fortawesome/fontawesome-free/scss/brands.scss",
"node_modules/angular-bootstrap-md/assets/scss/bootstrap/bootstrap.scss",
"node_modules/angular-bootstrap-md/assets/scss/mdb.scss",
"./node_modules/quill/dist/quill.core.css",
"./node_modules/quill/dist/quill.snow.css",
"node_modules/animate.css/animate.css",
"src/styles.css"
],
"scripts": [
"node_modules/chart.js/dist/Chart.js",
"node_modules/hammerjs/hammer.min.js",
"./node_modules/quill/dist/quill.js"
]
我的应用程序模块中有以下内容:
import { MDBBootstrapModule } from 'angular-bootstrap-md';
@NgModule({
imports: [
MDBBootstrapModule.forRoot(),
],
})
export class AppModule { }
我尝试将 MDBootstrapAccordion 之类的内容添加到应用程序模块的导入中,但没有出现任何内容。
有人可以告诉我手风琴显示缺少什么吗?
您使用 MDB Free,mdb-accordion
在此版本中不可用。您需要购买 PRO 版本才能在您的项目中使用它。
如您所见,文档中有一个'MDB Pro component'标签: