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

fix(toggle/checkbox): allow value to be updated when disabled #10304

Merged
merged 1 commit into from
Feb 3, 2017
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: 1 addition & 1 deletion src/components/checkbox/checkbox.ts
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ export class Checkbox extends Ion implements IonicTapInput, AfterContentInit, Co
* @private
*/
_setChecked(isChecked: boolean) {
if (!this._disabled && isChecked !== this._checked) {
if (isChecked !== this._checked) {
this._checked = isChecked;
if (this._init) {
this.ionChange.emit(this);
Expand Down
3 changes: 3 additions & 0 deletions src/components/checkbox/test/basic/app.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,9 @@ export class E2EPage {
'grape': this.grapeCtrl
});

public checked: boolean = false;
public disabled: boolean = false;

constructor() {
this.grapeChecked = true;
this.standAloneChecked = true;
Expand Down
16 changes: 16 additions & 0 deletions src/components/checkbox/test/basic/main.html
Original file line number Diff line number Diff line change
Expand Up @@ -88,4 +88,20 @@

<pre aria-hidden="true" padding>{{formResults}}</pre>

<ion-item>
<ion-label>Checkbox / Toggle</ion-label>
<ion-checkbox [(ngModel)]="checked" [disabled]="disabled"></ion-checkbox>
<ion-toggle [(ngModel)]="checked" [disabled]="disabled"></ion-toggle>
</ion-item>
<ion-item>
<ion-label>checked</ion-label>
<ion-checkbox [(ngModel)]="checked"></ion-checkbox>
<ion-toggle [(ngModel)]="checked"></ion-toggle>
</ion-item>
<ion-item>
<ion-label>disabled</ion-label>
<ion-checkbox [(ngModel)]="disabled"></ion-checkbox>
<ion-toggle [(ngModel)]="disabled"></ion-toggle>
</ion-item>

</ion-content>
2 changes: 1 addition & 1 deletion src/components/toggle/toggle.ts
Original file line number Diff line number Diff line change
Expand Up @@ -229,7 +229,7 @@ export class Toggle extends Ion implements IonicTapInput, AfterContentInit, Cont
* @private
*/
_setChecked(isChecked: boolean) {
if (!this._disabled && isChecked !== this._checked) {
if (isChecked !== this._checked) {
this._checked = isChecked;
if (this._init) {
this.ionChange.emit(this);
Expand Down