angular报错信息之 'zmz-select' is not a known element
文章栏目151615160
发布时间:2019-10-15 13:28:32

概述

angular报错信息之’zmz-select’ is not a known element: //“zmz select”不是已知元素:
当前错误原因是我们没有在NgModule上暴露出去我们写的组件所有会出现不是已知的元素

vendor.js:30013 Uncaught Error: Template parse errors:
'zmz-select' is not a known element:
If 'zmz-select' is an Angular component, then verify that it is part of this module.
If 'zmz-select' is a Web Component then add 'CUSTOM_ELEMENTS_SCHEMA' to the '@NgModule.schemas' of this component to suppress this message. ("
        </div>
    </div>
    [ERROR ->]<zmz-select></zmz-select>
</section>
"): ng:///AppRoutingModule/AboutComponent.html@103:4
    at syntaxError (vendor.js:30013)
    at TemplateParser.parse (vendor.js:42980)
    at JitCompiler._parseTemplate (vendor.js:51606)
    at JitCompiler._compileTemplate (vendor.js:51594)
    at vendor.js:51538
    at Set.forEach (<anonymous>)
    at JitCompiler._compileComponents (vendor.js:51538)
    at vendor.js:51451
    at Object.then (vendor.js:30004)
    at JitCompiler._compileModuleAndComponents (vendor.js:51450)

angular报错信息之 'zmz-select' is not a known element

解决方法

在NgModule上的declarations数组中添加我们要暴露的组件