【问题标题】:'block-ui' is not a known element:'block-ui' 不是已知元素:
【发布时间】:2019-07-30 13:16:01
【问题描述】:

目前,我正在从事 angular6 的项目, 我正确配置了 ng-block-ui(我已经在 angular5 中的一个项目中使用了 ng-block-ui),但是在组件模板中绑定时遇到了 ng-block-ui 的问题,如下所示

block-ui' is not a known element:
1. If 'block-ui' is an Angular component, then verify that it is part of this module.
2. If 'block-ui' is a Web Component then add 'CUSTOM_ELEMENTS_SCHEMA' to the '@NgModule.schemas' of this component to suppress this message. ("
[ERROR ->]<block-ui>
 <!-- Your app markup here -->
</block-ui>
"): ng:///HtmlLayoutModule/AdminComponent.html@0:0
Error: Template parse errors:

这是我正在使用的版本

"ng-block-ui": "^1.0.4",
"primeng": "^6.0.0-alpha.1",
"rxjs": "^6.2.0",
"rxjs-compat": "^6.2.0",

【问题讨论】:

  • 确保你已经在root中导入module?

标签: angular angular6 blockui angular-cli-v6


【解决方案1】:

截至目前,ng-block-uiRxJS 6 不兼容。 您可以尝试使用rxjs-compact 来确保向后兼容。 欲了解更多信息,您可以访问此链接:https://github.com/kuuurt13/ng-block-ui/issues/61

【讨论】:

    【解决方案2】:
    import { BlockUIModule } from 'ng-block-ui';
    
    @NgModule({
        BlockUIModule.forRoot()
      ]
    })
    
    import blockui in module.ts
    

    【讨论】:

    • 这个答案需要解释一下。
    • 需要在你的 app.moudle.ts 中添加这些行 import { BlockUIModule } from 'ng-block-ui';还要在 @NgModule 装饰器中添加 BlockUIModule.forRoot()
    猜你喜欢
    • 2017-07-27
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2017-05-07
    • 2011-08-16
    • 2014-05-13
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多