【发布时间】:2017-02-14 23:30:51
【问题描述】:
您好,我有一个 Angular 2 项目,效果很好。现在我想包含一个来自我通过脚本标签加载的 js 的外部指令,即 https://test.com/testDirectiveLoad.js 这个 js 包含一个指令。当我将脚本和指令放在 index.html 文件中时,指令有效。但我想将该指令包含在我的一个组件中,例如 headerComponent.ts。如果我将指令放在该组件中,浏览器会显示错误:
Template parse errors:
'test' is not a known element:
1. If 'test' is an Angular component, then verify that it is part of this module.
2. If 'test' is a Web Component then add "CUSTOM_ELEMENTS_SCHEMA" to the '@NgModule.schema' of this component to suppress this message.
谁能帮帮我
【问题讨论】:
标签: angular typescript