From b6dd99870113bda9f43416903becb0e65b006212 Mon Sep 17 00:00:00 2001 From: ossowski Date: Thu, 1 Jul 2021 10:12:29 +0200 Subject: [PATCH 1/2] feat(module:switch): add nzId input --- components/switch/switch.component.ts | 2 ++ 1 file changed, 2 insertions(+) diff --git a/components/switch/switch.component.ts b/components/switch/switch.component.ts index 67f67dab9a..8edf28f778 100644 --- a/components/switch/switch.component.ts +++ b/components/switch/switch.component.ts @@ -50,6 +50,7 @@ const NZ_CONFIG_MODULE_NAME: NzConfigKey = 'switch'; type="button" class="ant-switch" #switchElement + [attr.id]="nzId" [disabled]="nzDisabled" [class.ant-switch-checked]="isChecked" [class.ant-switch-loading]="nzLoading" @@ -94,6 +95,7 @@ export class NzSwitchComponent implements ControlValueAccessor, AfterViewInit, O @Input() nzCheckedChildren: string | TemplateRef | null = null; @Input() nzUnCheckedChildren: string | TemplateRef | null = null; @Input() @WithConfig() nzSize: NzSizeDSType = 'default'; + @Input() nzId: string | null = null; dir: Direction = 'ltr'; From 35109ccdbdb5443a9082bef1a42c1e3f16c9c302 Mon Sep 17 00:00:00 2001 From: ossowski Date: Thu, 1 Jul 2021 10:12:47 +0200 Subject: [PATCH 2/2] docs(module:switch): documentation update --- components/switch/doc/index.en-US.md | 1 + components/switch/doc/index.zh-CN.md | 1 + 2 files changed, 2 insertions(+) diff --git a/components/switch/doc/index.en-US.md b/components/switch/doc/index.en-US.md index 5303804c1b..f3dcd1f9f3 100755 --- a/components/switch/doc/index.en-US.md +++ b/components/switch/doc/index.en-US.md @@ -22,6 +22,7 @@ import { NzSwitchModule } from 'ng-zorro-antd/switch'; | Property | Description | Type | Default | Global Config | | -------- | ----------- | ---- | ------- | ------------- | +| `[nzId]` | button id attribute inside the component| `string` | - | | `[ngModel]` | determine whether the `nz-switch` is checked, double binding | `boolean` | `false` | | `[nzCheckedChildren]` | content to be shown when the state is checked | `string \| TemplateRef` | - | | `[nzUnCheckedChildren]` | content to be shown when the state is unchecked | `string \| TemplateRef` | - | diff --git a/components/switch/doc/index.zh-CN.md b/components/switch/doc/index.zh-CN.md index 7a5f14644f..562150b505 100755 --- a/components/switch/doc/index.zh-CN.md +++ b/components/switch/doc/index.zh-CN.md @@ -23,6 +23,7 @@ import { NzSwitchModule } from 'ng-zorro-antd/switch'; | 参数 | 说明 | 类型 | 默认值 | 全局配置 | | --- | --- | --- | --- | --- | +| `[nzId]` | 组件内部 button 的 id 值 | `string` | - | | `[ngModel]` | 指定当前是否选中,可双向绑定 | `boolean` | `false` | | `[nzCheckedChildren]` | 选中时的内容 | `string \| TemplateRef` | - | | `[nzUnCheckedChildren]` | 非选中时的内容 | `string \| TemplateRef` | - |