How can I get the radio button clicked value?
Actually I need a custom filter for gender which I selected in my <form>
. From the output I need to filter with gender. My filter
and orderBy
in ng-repeat
is not working properly.
Here is a link to my Plunker example: http://plnkr.co/edit/7ZBcMDrJzSreD73R9aNq?p=preview
for(var i=0;i<$scope.details.length;i++) {
if($scope.details[i]===$scope.options[i])
$scope.details=myService.getForm($scope.user);
}
In your Plunker given the value from the Gender is getting within the $scope.user
$scope.submitTheForm=function(){
myService.setForm($scope.user);
$scope.user={};
};
Check this Working Demo
I'm not sure about your jsfiddle but here is a quick example of how you do it:
<div class="radio" data-ng-repeat="detail in details">
<label>
<input type="radio" data-ng-model="$parent.ngModel" name="ngModel" value="{{detail.id}}" required />
{{detail.title}}
</label>
</div>
in your controller just use $scope.ngModel
and you will get the result.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.