Skip to content

Instantly share code, notes, and snippets.

@mlynch mlynch/app.plist forked from mhartington/
Last active Jan 27, 2019

What would you like to do?
.directive('ionRadioFix', function() {
return {
restrict: 'E',
replace: true,
require: '?ngModel',
transclude: true,
'<label class="item item-radio">' +
'<input type="radio" name="radio-group">' +
'<div class="radio-content">' +
'<div class="item-content disable-pointer-events" ng-transclude></div>' +
'<i class="radio-icon disable-pointer-events icon ion-checkmark"></i>' +
'</div>' +
compile: function(element, attr) {
if (attr.icon) {
var iconElm = element.find('i');
var input = element.find('input');
'value': attr.value,
'disabled': attr.disabled,
'ng-value': attr.ngValue,
'ng-model': attr.ngModel,
'ng-disabled': attr.ngDisabled,
'ng-change': attr.ngChange,
'ng-required': attr.ngRequired,
'required': attr.required
}, function(value, name) {
if (angular.isDefined(value)) {
input.attr(name, value);
return function(scope, element, attr) {
scope.getValue = function() {
return scope.ngValue || attr.value;
.item-radio input:checked + .radio-content .item-content {
/* style the item content when its checked */
background: #f7f7f7;
.item-radio input:checked + .radio-content .radio-icon {
/* show the checkmark icon when its checked */
visibility: visible;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.