mirror of
https://github.com/ionic-team/ionic-framework.git
synced 2026-03-13 10:22:08 +08:00
amend(ionRadio): make sure value is passed down always
This commit is contained in:
9
js/angular/directive/radio.js
vendored
9
js/angular/directive/radio.js
vendored
@@ -32,7 +32,7 @@ IonicModule
|
||||
transclude: true,
|
||||
template: '<label class="item item-radio">' +
|
||||
'<input type="radio" name="radio-group"' +
|
||||
' ng-model="ngModel" ng-value="ngValue" ng-change="ngChange()">' +
|
||||
' ng-model="ngModel" ng-value="getValue()" ng-change="ngChange()">' +
|
||||
'<div class="item-content disable-pointer-events" ng-transclude></div>' +
|
||||
'<i class="radio-icon disable-pointer-events icon ion-checkmark"></i>' +
|
||||
'</label>',
|
||||
@@ -40,7 +40,12 @@ IonicModule
|
||||
compile: function(element, attr) {
|
||||
if(attr.name) element.children().eq(0).attr('name', attr.name);
|
||||
if(attr.icon) element.children().eq(2).removeClass('ion-checkmark').addClass(attr.icon);
|
||||
if(attr.value) element.children().eq(0).attr('value', attr.value);
|
||||
|
||||
return function(scope, element, attr) {
|
||||
scope.getValue = function() {
|
||||
return scope.ngValue || attr.value;
|
||||
};
|
||||
};
|
||||
}
|
||||
};
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user