重用组件模板 angular 7

Reuse component template angular 7

是否有任何简单的方法可以在组件 2 中重用组件 1 中的模板?

可能的方法思路:

  1. 将 component1 用作 component2 元素中的子组件。

  2. 创建模板,并在组件 1 和组件 2 模板中与 ng-template 一起使用。

  3. 在 component2 装饰器中只需指定 component1 模板文件。