ngx-formly icon indicating copy to clipboard operation
ngx-formly copied to clipboard

Misalignment of form fields while using angular formly with ng-zorro ant design

Open codebanesr opened this issue 5 years ago • 3 comments

Template

<form [formGroup]="validateForm" (ngSubmit)="submitForm()" class="leadCreateForm" nz-form>
  <formly-form nz-form [form]="validateForm" [model]="model" [fields]="fields">
  </formly-form>

  <button nz-button nzType="primary" type="submit">
    Submit
  </button>
  <button nz-button nzType="danger" type="reset">
    Reset
  </button>
</form>

Screenshot 2020-06-21 at 12 12 48 AM

This is not what ant design forms normally would look like, for example my forms elsewhere look like Screenshot 2020-06-21 at 12 13 35 AM

Is there a way to fix this issue, i know ng zorro uses directives for this. Any help would be appreciated

codebanesr avatar Jun 20 '20 20:06 codebanesr

horizontal layout not supported yet, for now, rely on vertical layout which can be done by importing NzFormModule and passing vertical to nzLayout input:

+ import { NzFormModule } from 'ng-zorro-antd/form';

@NgModule({
  imports: [
+   NzFormModule,
    ...
  ],
})
export class AppModule {}
<form
+ nz-form [nzLayout]="'vertical'"
  [formGroup]="form" (ngSubmit)="onSubmit()"
>
...
</form>

aitboudad avatar Jun 28 '20 21:06 aitboudad

Thanks @aitboudad

codebanesr avatar Jul 02 '20 14:07 codebanesr

I would set vertical alignment by default, as it is how it looks by default with other UIs. Is it viable?

alvarolb avatar Jul 25 '23 16:07 alvarolb