AngularJS provides ng-model to bind values to input fields. Binding radio buttons to scope variables is tricky.

Markup

Here you can find HTML markup of Gender radio buttons. 
<input type="radio" ng-model="gender" value="male" name="gender"/> Male
<input type="radio" ng-model="gender" value="female" name="gender"/> Female

Script

This is script to access radio input variables in scope controllers

function myCtrl($scope) {
    $scope.gender = 'male';
}

0 comments:

Blogroll

Follow this blog by Email

Popular Posts