我想要做的事情是:角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