Skip to content

Commit 0d27e0e

Browse files
committed
amend(ionRadio): make sure value is passed down always
1 parent 9950534 commit 0d27e0e

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

js/angular/directive/radio.js

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,15 +32,20 @@ IonicModule
3232
transclude: true,
3333
template: '<label class="item item-radio">' +
3434
'<input type="radio" name="radio-group"' +
35-
' ng-model="ngModel" ng-value="ngValue" ng-change="ngChange()">' +
35+
' ng-model="ngModel" ng-value="getValue()" ng-change="ngChange()">' +
3636
'<div class="item-content disable-pointer-events" ng-transclude></div>' +
3737
'<i class="radio-icon disable-pointer-events icon ion-checkmark"></i>' +
3838
'</label>',
3939

4040
compile: function(element, attr) {
4141
if(attr.name) element.children().eq(0).attr('name', attr.name);
4242
if(attr.icon) element.children().eq(2).removeClass('ion-checkmark').addClass(attr.icon);
43-
if(attr.value) element.children().eq(0).attr('value', attr.value);
43+
44+
return function(scope, element, attr) {
45+
scope.getValue = function() {
46+
return scope.ngValue || attr.value;
47+
};
48+
};
4449
}
4550
};
4651
});

0 commit comments

Comments
 (0)