小编a.a*_*dad的帖子

如何使用 ngx-formly 为 2 个字段组制作自定义包装器?

我很困惑如何使用 ngx-formly 为我的表单与字段进行布局。例如,我有 2 个字段组:General 和 Dynamic。 例子

如何指定一般将在一个 div 中,并在一个下拉列表(div)内的另一个 div 中动态?

官方示例如下: 包装器:

 <div class="card">
      <h3 class="card-header">{{ to.label }}</h3>
      <div class="card-body">
        <ng-container #fieldComponent></ng-container>
      </div>
    </div>
Run Code Online (Sandbox Code Playgroud)

成分:

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',
        },
      }],
    },
  ];
Run Code Online (Sandbox Code Playgroud)

而这里<ng-container #fieldComponent></ng-container>没有具体说明它是哪个字段

forms angular ngx-formly

0
推荐指数
1
解决办法
4269
查看次数

标签 统计

angular ×1

forms ×1

ngx-formly ×1