Ion-radio first item checked


#1

Is there a bug with the directive? I can’t seem to set one radio button (inside a collection of radio buttons) to be checked…

I’ve tried everything, it just doesn’t work…

Example im using:

         <div class="list list-inset"> 
            <ion-radio ng-repeat="r in radioButtons" ng-model="user.encryption" ng-checked="r.checked" ng-      value="r.value">  {{r.text}}</ion-radio>  
         </div>

and in controller:

     $scope.radioButtons = [
        {text: "No Encryption", value: "no_encryption", checked : "checked"},
        {text: "MD5", value: "md5_encryption"},
        {text: "SHA1", value: "sha1_encryption"},
     ]; 

The above is just one example i’ve tried, i’ve tried so many, even setting ng-checked=“true” or “checked” manually.

Am i doing something wrong?

Thanks


#2

Does no one use ion-radio ? lol


#3

I have the very sam problem, did anybody solve it?


#4

I think you can set default value for ng-model, then relative radio will been checked.

<ion-list ng-repeat="player in players"> <ion-radio ng-model="winner" ng-value="player" name="winner">{{player}}</ion-radio> </ion-list>

$scope.players = [“a”,“b”,“c”];
$scope.winner = “b”; // defualt check player b


#5

how to set default checked in case if i have $scope.players is an array objects ?@ ohahec