我很困惑如何使用 ngx-formly 为我的表单进行布局。例如,我有 2 个字段组:General 和 Dynamic。
如何指定一般将在一个 div 中,并在一个下拉(div)内的另一个 div 中动态?
官方示例如下: Wrapper:
<div class="card">
<h3 class="card-header">{{ to.label }}</h3>
<div class="card-body">
<ng-container #fieldComponent></ng-container>
</div>
</div>
零件:
fields: FormlyFieldConfig[] = [
{
key: 'firstName',
type: 'input',
templateOptions: {
required: true,
type: 'text',
label: 'First Name',
},
},
{
key: 'address',
wrappers: ['panel'],
templateOptions: { label: 'Address' },
fieldGroup: [{
key: 'town',
type: 'input',
templateOptions: {
required: true,
type: 'text',
label: 'Town',
},
}],
},
];
这里<ng-container #fieldComponent></ng-container>
没有指定它到底是哪个字段