Skip to content

Commit

Permalink
fix(ionRadio): fix custom icons
Browse files Browse the repository at this point in the history
  • Loading branch information
mhartington committed Sep 11, 2015
1 parent 53c56ce commit 18499c3
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 16 deletions.
3 changes: 2 additions & 1 deletion js/angular/directive/radio.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,8 @@ IonicModule

compile: function(element, attr) {
if (attr.icon) {
element.children().eq(2).removeClass('ion-checkmark').addClass(attr.icon);
var iconElm = element.find('i');
iconElm.removeClass('ion-checkmark').addClass(attr.icon);
}

var input = element.find('input');
Expand Down
31 changes: 16 additions & 15 deletions test/html/input-radio-zarko.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<head>
<meta charset="utf-8">
<meta name="viewport" content="initial-scale=1, maximum-scale=1, user-scalable=no, width=device-width">

<title>Radio Buttons</title>

<link href="../../dist/css/ionic.css" rel="stylesheet">
Expand All @@ -11,41 +11,42 @@
</head>

<body ng-controller="MainCtrl">

<ion-header-bar class="bar-positive">
<h1 class="title">Radio Buttons</h1>
</ion-header-bar>

<ion-content>

<div class="list">
<div class="item item-divider">

<div class="item item-divider">
Clientside, Selected Value: {{ data.clientSide }}
</div>

<ion-radio ng-repeat="item in clientSideList"
ng-value="item.value"
ng-model="data.clientSide">
{{ item.text }}
</ion-radio>

<div class="item item-divider">
Serverside, Selected Value: {{ data.serverSide }}
</div>

<ion-radio ng-repeat="item in serverSideList"
ng-value="item.value"
ng-model="data.serverSide"
ng-change="serverSideChange(item)"
icon="ion-home"
name="server-side">
{{ item.text }}
</ion-radio>

</div>

</ion-content>

<script>

angular.module('ionicApp', ['ionic'])
Expand All @@ -65,15 +66,15 @@ <h1 class="title">Radio Buttons</h1>
{ text: "Ruby", value: "rb" },
{ text: "Java", value: "jv" }
];

$scope.data = {
clientSide: 'ng'
};

$scope.serverSideChange = function(item) {
console.log("Selected Serverside, text:", item.text, "value:", item.value);
};

});
</script>
</body>
Expand Down

0 comments on commit 18499c3

Please sign in to comment.