Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(module:checkbox): add nzId input #6813

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions components/checkbox/checkbox.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ import { NzCheckboxWrapperComponent } from './checkbox-wrapper.component';
type="checkbox"
class="ant-checkbox-input"
[attr.autofocus]="nzAutoFocus ? 'autofocus' : null"
[attr.id]="nzId"
[checked]="nzChecked"
[ngModel]="nzChecked"
[disabled]="nzDisabled"
Expand Down Expand Up @@ -89,6 +90,7 @@ export class NzCheckboxComponent implements OnInit, ControlValueAccessor, OnDest
@Input() @InputBoolean() nzDisabled = false;
@Input() @InputBoolean() nzIndeterminate = false;
@Input() @InputBoolean() nzChecked = false;
@Input() nzId: string | null = null;

hostClick(e: MouseEvent): void {
e.preventDefault();
Expand Down
1 change: 1 addition & 0 deletions components/checkbox/doc/index.en-US.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ import { NzCheckboxModule } from 'ng-zorro-antd/checkbox';

| Property | Description | Type | Default |
| -------- | ----------- | ---- | ------- |
| `[nzId]` | input id attribute inside the component| `string` | - |
| `[nzAutoFocus]` | get focus when component mounted | `boolean` | `false` |
| `[nzDisabled]` | Disable checkbox | `boolean` | `false` |
| `[ngModel]` | Specifies whether the checkbox is selected, double binding | `boolean` | `false` |
Expand Down
1 change: 1 addition & 0 deletions components/checkbox/doc/index.zh-CN.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ import { NzCheckboxModule } from 'ng-zorro-antd/checkbox';

| 参数 | 说明 | 类型 | 默认值 |
| --- | --- | --- | --- |
| `[nzId]` | 组件内部 input 的 id 值 | `string` | - |
| `[nzAutoFocus]` | 自动获取焦点 | `boolean` | `false` |
| `[nzDisabled]` | 设定 disable 状态 | `boolean` | `false` |
| `[ngModel]` | 指定当前是否选中,可双向绑定 | `boolean` | `false` |
Expand Down