我想要做的事情是:角2/4传球@input一个多行字符串右模板
<app-preview
[title]="'Some words
'which' "can" <be>
`surrounded` by any quotes
and located in several lines
'"
</app-preview>
我想通过不含有多串组件的属性,我想在模板中通过它。
我该如何做到这一点?
PS - 变量对我来说不起作用,因为我传递的字符串是html,它们对于每个SubComponent
都是唯一的,它可以通过@Input
获取数据。字符串的
例子中,我试图通过:
<app-preview
[title]="'Default (disabled)'"
[lang]="'html'"
[code]="
<am-input
[placeholder]="'Placeholder'"
[disabled]="true">
</am-input>
">
</app-preview>
ngFor
也不合适与格,因为我确定正确的页面组件每科和DemoComponent
为什么你想在模板中做到这一点?你想要渲染的结果是什么? – jonrsharpe
@jonrsharpe因为我的'Component'有大约60个'SubComponents',它必须为每个'SubComponent'多行字符串接收唯一的。在'Component'中创建60个属性,我认为这是一个不好的解决方案 –
为什么你要创建60个属性?只需要在这些输入的*数组*中包含一个'ngFor'。这将比模板中的60个子组件更好看。 – jonrsharpe