/**
* @ngdoc directive
* @name ionRadio
* @module ionic
* @restrict E
* @codepen saoBG
* @description
* The radio directive is no different than the HTML radio input, except it's styled differently.
*
* Radio behaves like any [AngularJS radio](http://docs.angularjs.org/api/ng/input/input[radio]).
*
* @usage
* ```html
* Choose A
* Choose B
* Choose C
* ```
*/
IonicModule
.directive('ionRadio', function() {
return {
restrict: 'E',
replace: true,
require: '?ngModel',
scope: {
ngModel: '=?',
ngValue: '=?',
ngDisabled: '=?',
ngChange: '&',
icon: '@',
name: '@'
},
transclude: true,
template: '',
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);
return function(scope, element, attr) {
scope.getValue = function() {
return scope.ngValue || attr.value;
};
};
}
};
});