[英]How To Put HTMLElement Inside Component Like Angular Material does
In AngularMaterial, I saw code like this. 在AngularMaterial中,我看到了这样的代码。
<form class="example-form">
<mat-form-field class="example-full-width">
<input matInput placeholder="Favorite food" value="Sushi">
</mat-form-field>
</form>
There are <input>
element inside <mat-form-field>
component. <mat-form-field>
组件内部有<input>
元素。
Usually, when I wrote element inside component, It wil be ignored. 通常,当我在组件内部编写元素时,它将被忽略。
How can I do this. 我怎样才能做到这一点。
Using <ng-content></ng-content>
to slot your element. 使用<ng-content></ng-content>
放置元素。
https://medium.com/claritydesignsystem/ng-content-the-hidden-docs-96a29d70d11b https://medium.com/claritydesignsystem/ng-content-the-hidden-docs-96a29d70d11b
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.