Angular 'mdb-navbar-brand' 不是已知元素:

ruw*_*age 2 angular angular7

我在参与一个有角度的项目时遇到了这个错误。我不明白我该怎么办。任何人都可以帮助我吗?

SCRIPT5022: Template parse errors:
'mdb-navbar-brand' is not a known element:
1. If 'mdb-navbar-brand' is an Angular component, then verify that it is part of this module.
2. If 'mdb-navbar-brand' is a Web Component then add 'CUSTOM_ELEMENTS_SCHEMA' to the '@NgModule.schemas' of this component to suppress this message. ("
Run Code Online (Sandbox Code Playgroud)

Ani*_*Das 7

您需要先导入模块才能在您的组件中使用它。所以在你的应用程序组件中像下面这样导入它。

import { MDBBootstrapModule } from 'angular-bootstrap-md';

@NgModule({
    imports: [
        MDBBootstrapModule.forRoot()
    ]
});
Run Code Online (Sandbox Code Playgroud)

scss如果您使用的是 angular cli,请添加到您的 angular.json 配置文件中

"node_modules/angular-bootstrap-md/scss/bootstrap/bootstrap.scss",
"node_modules/angular-bootstrap-md/scss/mdb-free.scss",
Run Code Online (Sandbox Code Playgroud)

现在它应该适用于所有风格