fix(radio): radio w/ falsy value not checkable

Closes #5348
This commit is contained in:
Adam Bradley
2016-02-11 22:12:02 -06:00
parent d1808f9dd1
commit 89861e0e61
3 changed files with 22 additions and 1 deletions

View File

@@ -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();

View File

@@ -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() {

View File

@@ -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>