在StackOverflow中有不少文章提供了比Angular 2文档更好的细节,介绍如何在另一个自定义组件中包含自定义组件。但是,即使我遵循这些指令(确保注入的组件位于模块定义的declarations
块中,并且还确保注入的组件位于组件定义的directives
块中),但它仍会引发错误:Angular 2:无法将组件包含到另一个
Unhandled Promise rejection: 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.schemas' of this component to suppress this message. ("
</footer>
[ERROR ->]<test></test>
您可以查看Github repo。我开始a branch我试图找出它。
我可以忘记什么?任何指导表示赞赏。
我特别希望它们成为独立的模块,以便重新使用和分离问题。 – jansensan