![](/img/trans.png)
[英]Implementing 2 components and using both one inside another just like angular-material does with its component
[英]How To Put HTMLElement Inside Component Like Angular Material does
在AngularMaterial中,我看到了這樣的代碼。
<form class="example-form">
<mat-form-field class="example-full-width">
<input matInput placeholder="Favorite food" value="Sushi">
</mat-form-field>
</form>
<mat-form-field>
組件內部有<input>
元素。
通常,當我在組件內部編寫元素時,它將被忽略。
我怎樣才能做到這一點。
使用<ng-content></ng-content>
放置元素。
https://medium.com/claritydesignsystem/ng-content-the-hidden-docs-96a29d70d11b
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.