Skip to content

Allow Modal nzCentered in default config, or just default it to true #7458

@tegola

Description

@tegola

What problem does this feature solve?

I always find myself centering modals with nzCentered: true, and I wish it would be the default. Since making it the default now would break existing apps, I'm wondering if the nzCentered parameter could be passed in the default NZ_CONFIG provider in AppModule?

Thanks

What does the proposed API look like?

// app.module.ts
const ngZorroConfig: NzConfig = {
  modal: {
    nzCentered: true
  }
};

// ...

@NgModule({
  declarations: [AppComponent],
  providers: [
    { provide: NZ_CONFIG, useValue: ngZorroConfig },
  ],
  bootstrap: [AppComponent],
})
export class AppModule {}
// Opening a modal before this change
this.modalService.confirm({
  nzCentered: true,
  nzTitle: 'Title',
  nzContent: 'Content',
});

// Opening a modal after this change
this.modalService.confirm({
  nzTitle: 'Title',
  nzContent: 'Content',
});

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions