Last active
August 29, 2015 14:00
-
-
Save perrygovier/11402419 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
.directive('ionRadio', function() { | |
return { | |
restrict: 'E', | |
replace: true, | |
require: '?ngModel', | |
scope: { | |
ngModel: '=?', | |
ngValue: '=?', | |
ngChange: '&', | |
icon: '@', | |
name: '@' | |
}, | |
transclude: true, | |
template: '<label class="item item-radio">' + | |
'<input type="radio" name="{{name}}"' + | |
' ng-model="ngModel" ng-value="ngValue" 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>', | |
compile: function(element, attr) { | |
//console.log(element.children().eq(0)); | |
console.log(attr); | |
if(typeof attr.name === 'undefined') element.children().eq(0).attr('name', 'radio-group'); | |
if(attr.icon) element.children().eq(2).removeClass('ion-checkmark').addClass(attr.icon); | |
} | |
}; | |
}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment