Q:

How to get radio button selected value from dynamically generated radio buttons?

Hi I am developing web application in angularjs. I am generating radiobuttons dynamically using ng-repeat as below.
<ul>
    <li ng-repeat="level in permissions">
        <input name="level.perm_levelname" type="radio" ng-model="level.perm_levelname" value="{{level.perm_levelname}}"> {{level.perm_levelname}}
        <a ng-click="gotopermMap({permisssionID: level.id})">View</a>
    </li>
</ul>
<input type="button" value="APPLY" ng-click="apply()" />

I am trying to get selected radio button as below.
 $scope.apply=function()
        {
            var permname = $scope.name;
            console.log($scope.level.perm_levelname);
        }

I am getting error  Cannot read property 'perm_levelname' of undefined. May i get help here to get selected radio button? Thank you

A:

group radio buttons by a name and specify a common scope variable for radio buttons ng-modal
   <ul>
     <li ng-repeat="level in permissions">
       <input name="myradiobtn" type="radio" ng-model="myradioBtnValue" ng-value="level.perm_levelname">
       {{level.perm_levelname}}
       <a ng-click="gotopermMap({permisssionID: level.id})">View</a>
     </li>
   </ul>
   <input type="button" value="APPLY" ng-click="apply()"/>

