mirror of
https://github.com/ionic-team/ionic-framework.git
synced 2026-03-13 10:22:08 +08:00
Fixed #272
This commit is contained in:
29
js/ext/angular/src/directive/ionicRadio.js
vendored
29
js/ext/angular/src/directive/ionicRadio.js
vendored
@@ -14,8 +14,8 @@ angular.module('ionic.ui.radio', [])
|
||||
value: '@'
|
||||
},
|
||||
transclude: true,
|
||||
template: '<label skip-tap-poly ng-click="tapHandler($event)" class="item item-radio">\
|
||||
<input type="radio" name="group">\
|
||||
template: '<label class="item item-radio">\
|
||||
<input type="radio" name="radio-group">\
|
||||
<div class="item-content" ng-transclude>\
|
||||
</div>\
|
||||
<i class="radio-icon icon ion-checkmark"></i>\
|
||||
@@ -30,21 +30,14 @@ angular.module('ionic.ui.radio', [])
|
||||
|
||||
if(!radio.length) { return; }
|
||||
|
||||
$scope.tapHandler = function(e) {
|
||||
console.log("RADIOTAP");
|
||||
radio[0].checked = true;
|
||||
ngModel.$setViewValue($scope.$eval($attr.ngValue));
|
||||
e.alreadyHandled = true;
|
||||
};
|
||||
|
||||
var clickHandler = function(e) {
|
||||
console.log("RADIOCLICK");
|
||||
ngModel.$setViewValue($scope.$eval($attr.ngValue));
|
||||
};
|
||||
|
||||
if(ngModel) {
|
||||
//$element.bind('tap', tapHandler);
|
||||
$element.bind('click', clickHandler);
|
||||
radio.bind('click', function(e) {
|
||||
console.log('RADIO CLICK');
|
||||
$scope.$apply(function() {
|
||||
ngModel.$setViewValue($scope.$eval($attr.ngValue));
|
||||
});
|
||||
e.alreadyHandled = true;
|
||||
});
|
||||
|
||||
ngModel.$render = function() {
|
||||
var val = $scope.$eval($attr.ngValue);
|
||||
@@ -114,7 +107,7 @@ angular.module('ionic.ui.radio', [])
|
||||
if(!ngModel || !radioButtons) { return; }
|
||||
|
||||
var setIt = function() {
|
||||
console.trace('SET');
|
||||
console.log('SET');
|
||||
$element.addClass('active');
|
||||
ngModel.$setViewValue($scope.$eval($attr.ngValue));
|
||||
|
||||
@@ -132,7 +125,7 @@ angular.module('ionic.ui.radio', [])
|
||||
};
|
||||
});
|
||||
|
||||
$element.bind('tap', clickHandler);
|
||||
$element.bind('click', clickHandler);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user