Skip to content

Commit

Permalink
fix(module: checkbox): disable checked status while disabled is true (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
fisherspy committed Dec 19, 2018
1 parent d29a08a commit 5fe311f
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 2 deletions.
1 change: 1 addition & 0 deletions components/checkbox/agree-item.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ export class AgreeItem implements ControlValueAccessor {
constructor() { }

change(event) {
this.checked = event.checked;
this._ngModelOnChange(event.checked);
this.onChange.emit(event);
}
Expand Down
1 change: 1 addition & 0 deletions components/checkbox/checkbox-item.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ export class CheckboxItem implements ControlValueAccessor {
onCheckboxClick(event) { }

change(event) {
this.checked = event.checked;
this._ngModelOnChange(event.checked);
this.onChange.emit(event);
}
Expand Down
1 change: 1 addition & 0 deletions components/checkbox/checkbox.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
[attr.name]="name"
[attr.value]="value"
[checked]="checked"
[disabled]="disabled"
>
<span class="{{prefixCls}}-inner"></span>
</span>
Expand Down
6 changes: 4 additions & 2 deletions components/checkbox/checkbox.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,10 @@ export class Checkbox implements OnInit {
return this._checked;
}
set checked(value: boolean) {
this._checked = value;
this.updateClassMap();
if (!this._disabled) {
this._checked = value;
this.updateClassMap();
}
}
@Input()
get disabled(): boolean {
Expand Down
1 change: 1 addition & 0 deletions components/radio/radio.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
[attr.name]="name"
[attr.value]="value"
[checked]="checked"
[disabled]="disabled"
>
<span class="{{prefixCls}}-inner"></span>
</span>
Expand Down

0 comments on commit 5fe311f

Please sign in to comment.