angular - Angular 'mdb-navbar-brand' 不是已知元素:
问题描述
我在从事 Angular 项目时遇到了这个错误。我不明白我该怎么办。任何人都可以帮助我吗?
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. ("
解决方案
您需要先导入模块才能在组件中使用它。因此,在您的应用程序组件中导入它,如下所示。
import { MDBBootstrapModule } from 'angular-bootstrap-md';
@NgModule({
imports: [
MDBBootstrapModule.forRoot()
]
});
scss
如果您使用 angular cli,请添加到您的 angular.json 配置文件
"node_modules/angular-bootstrap-md/scss/bootstrap/bootstrap.scss",
"node_modules/angular-bootstrap-md/scss/mdb-free.scss",
现在它应该适用于所有风格
推荐阅读
- c# - 在调试器快照中隐藏敏感数据
- javascript - undefined 不是对象(评估“this.props.navigation”)
- r - jupyter中的r图-无法启动png()设备
- react-native - React Navigation - 如何在屏幕之间重复传递数据?
- path - Windows 8.1 中意外删除的路径变量
- xamarin - 无法解析程序集或 Windows 元数据文件“Shared.dll”
- java - Nashorn 访问 Java 对象的方法
- react-native - 在 Play 商店中上传 React Native 应用程序
- spring - Spring数据redis java.lang.NoSuchMethodError: org.springframework.util.Assert.isTrue(ZLjava/util/function/Supplier;)V
- html - 表单提交在 Ruby on mobile 视图中创建 GET 调用而不是 POST 调用