fix(radio): select only one radio when w/out ngModel

Closes #5659
This commit is contained in:
Adam Bradley
2016-03-05 22:21:29 -06:00
parent a0b5ca15dc
commit e92feefc07
3 changed files with 10 additions and 7 deletions

View File

@@ -125,6 +125,7 @@ export class RadioGroup {
registerOnChange(fn: Function): void {
this._fn = fn;
this.onChange = (val: any) => {
// onChange used when there's an ngControl
console.debug('radio group, onChange', val);
fn(val);
this.value = val;
@@ -206,7 +207,14 @@ export class RadioGroup {
/**
* @private
*/
onChange(_) {}
onChange(val: any) {
// onChange used when there is not an ngControl
console.debug('radio group, onChange w/out ngControl', val);
this.value = val;
this._update();
this.onTouched();
this.change.emit(val);
}
/**
* @private

View File

@@ -13,7 +13,6 @@ class E2EApp {
currencies: Array<string>;
items: Array<{description: string, value: any}>;
relationship: string;
pet: string;
selectedTime: number = 60;
constructor() {

View File

@@ -80,7 +80,7 @@
<code><b>relationship:</b> {{relationship}}</code>
</div>
<div radio-group [(ngModel)]="pet" (change)="petChange($event)">
<div radio-group (change)="petChange($event)">
<p>
<ion-radio (select)="dogSelect($event)"></ion-radio>
Dogs
@@ -95,10 +95,6 @@
</p>
</div>
<div padding>
<code><b>pet:</b> {{pet}}</code>
</div>
<ion-list radio-group [(ngModel)]="someValue">
<ion-item *ngFor="#item of items">
<ion-label>