相关疑难解决方法(0)

测试Angular 2应用程序时出现"CUSTOM_ELEMENTS_SCHEMA"错误

在为我的Angular 2应用程序编写测试时,我遇到了这些错误:我们正在使用的选择器:

"): AppComponent@12:35 'tab-view' is not a known element:
1. If 'my-tab' is an Angular component, then verify that it is part of this module.
2. If 'my-tab' is a Web Component then add "CUSTOM_ELEMENTS_SCHEMA" to the '@NgModule.schemas' of this component to suppress this message. ("
    </div>
    <div class="app-body">
        [ERROR ->]<tab-view class="my-tab" [options]="tabOptions"></tab-view>
    </div> </div> 
Run Code Online (Sandbox Code Playgroud)

我已经添加CUSTOM_ELEMENTS_SCHEMA到我的根模块,以及所有其他模块,但我仍然得到错误.

  • 我还需要做什么?
  • 这需要在所有模块中,还是只在根目录中?
  • 还有什么需要补充的吗?

javascript unit-testing typescript angular

11
推荐指数
2
解决办法
8061
查看次数

标签 统计

angular ×1

javascript ×1

typescript ×1

unit-testing ×1