From a2f858bb5624d65ba5d5a06d96d7ef6f6cc5ca3d Mon Sep 17 00:00:00 2001 From: Adam Bradley Date: Sat, 5 Mar 2016 12:36:57 -0600 Subject: [PATCH] fix(radio): do not use strict comparison for values Closes #5660 --- ionic/components/radio/radio-button.ts | 2 +- ionic/components/radio/radio-group.ts | 4 ++-- ionic/components/radio/test/basic/index.ts | 1 + ionic/components/radio/test/basic/main.html | 18 ++++++++++++++++-- 4 files changed, 20 insertions(+), 5 deletions(-) diff --git a/ionic/components/radio/radio-button.ts b/ionic/components/radio/radio-button.ts index c9d7c899a4..f45a2cd65f 100644 --- a/ionic/components/radio/radio-button.ts +++ b/ionic/components/radio/radio-button.ts @@ -142,7 +142,7 @@ export class RadioButton { * @private */ ngOnInit() { - if (this._group && isDefined(this._group.value) && this._group.value === this.value) { + if (this._group && isDefined(this._group.value) && this._group.value == this.value) { this.checked = true; } } diff --git a/ionic/components/radio/radio-group.ts b/ionic/components/radio/radio-group.ts index 64c7d2659b..165d36bf98 100644 --- a/ionic/components/radio/radio-group.ts +++ b/ionic/components/radio/radio-group.ts @@ -148,7 +148,7 @@ export class RadioGroup { // check this radiobutton if its value is // the same as the radiogroups value - radioButton.checked = (radioButton.value === this.value); + radioButton.checked = (radioButton.value == this.value); if (radioButton.checked) { // if this button is checked, then set it as @@ -183,7 +183,7 @@ export class RadioGroup { remove(button: RadioButton) { let index = this._btns.indexOf(button); if (index > -1) { - if (button.value === this.value) { + if (button.value == this.value) { this.value = null; } this._btns.splice(index, 1); diff --git a/ionic/components/radio/test/basic/index.ts b/ionic/components/radio/test/basic/index.ts index a112bc9eec..fa784ec485 100644 --- a/ionic/components/radio/test/basic/index.ts +++ b/ionic/components/radio/test/basic/index.ts @@ -14,6 +14,7 @@ class E2EApp { items: Array<{description: string, value: any}>; relationship: string; pet: string; + selectedTime: number = 60; constructor() { this.fruits = new Control('apple'); diff --git a/ionic/components/radio/test/basic/main.html b/ionic/components/radio/test/basic/main.html index 773b533563..9ce3d253c3 100644 --- a/ionic/components/radio/test/basic/main.html +++ b/ionic/components/radio/test/basic/main.html @@ -99,7 +99,7 @@ pet: {{pet}} - + {{ item.description }} @@ -110,7 +110,21 @@
- someNumber: {{someNumber}} + someValue: {{someValue}}
+ + + Time + + + 60 minutes + + + + 30 minutes + + + +