递归ng-template

时间:2018-01-24 12:17:21

标签: angular typescript templates recursion components

我有一个关于ng-template的递归和获取由ng-template生成的组件的问题,看起来会像这样:

<template #recursion>
    <header>
        <item>
            <repeat template #recursion><repeat>
        </item>
    </header>
<template>

当我在标题上使用@ContentChildren时,您将获得ng-content的项目列表,但是当您在项目上使用@ContentChildren时,您将无法获得ng-中的标题列表内容。

我的期望是@ContentChildren对项目将返回由ng-template生成的标题列表。

我的例子:Stackblitz

我该如何解决这个问题?我尝试了很多不同的解决方案,但它不起作用。

谢谢:)

0 个答案:

没有答案