问题描述
是否有一个易于遵循的示例,说明如何将mat-form-field
封装在子组件中?
我想要的
<form [formGroup]="form">
<my-component
formControlName="someFormValue"
label="hi">
</my-component>
<form>
以及在my-component.html
中<mat-form-field>
<mat-label>
{{ label }}
</mat-label>
<input
matInput
...
/>
<mat-error>
.... some form validation errors here
</mat-error>
</mat-form-field>
干杯...
解决方法
最好的选择是stock
,而不是FormControl-而不是formControlName-
updateOne: {
filter: { _id: prod._id },update: { $inc: { "stock.$[elem].stock": -prod.quantity,sold: +prod.quantity } },arrayFilters: [{ "elem.size": prod.size }]
}
并在组件中使用
select * from mytab sample(5) fetch next 1 rows only;
已更新:一个quick stackblitz