Skip to content

Commit

Permalink
fix(radio): radio w/ falsy value not checkable
Browse files Browse the repository at this point in the history
Closes #5348
  • Loading branch information
adamdbradley committed Feb 12, 2016
1 parent d1808f9 commit 89861e0
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 1 deletion.
2 changes: 1 addition & 1 deletion ionic/components/radio/radio-group.ts
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ export class RadioGroup {
let oldVal = this.value;

// set the radiogroup's value
this.value = val || '';
this.value = isDefined(val) ? val : '';

this.updateValue();

Expand Down
7 changes: 7 additions & 0 deletions ionic/components/radio/test/basic/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,13 @@ class E2EApp {

this.relationship = 'enemies';


this.items = [
{ description: 'value undefined', value: undefined },
{ description: 'value false string', value: 'false' },
{ description: 'value false boolean', value: false },
{ description: 'value 0', value: 0 },
];
}

setApple() {
Expand Down
14 changes: 14 additions & 0 deletions ionic/components/radio/test/basic/main.html
Original file line number Diff line number Diff line change
Expand Up @@ -99,4 +99,18 @@
<code><b>pet:</b> {{pet}}</code>
</div>

<ion-list radio-group [(ngModel)]="someNumber">
<ion-item *ngFor="#item of items">
<ion-label>
{{ item.description }}
</ion-label>
<ion-radio [value]="item.value"></ion-radio>
</ion-item>
</ion-list>

<div padding>
<code><b>someNumber:</b> {{someNumber}}</code>
</div>

</ion-content>

0 comments on commit 89861e0

Please sign in to comment.