In this article I will explain with an example, how to use AngularJS ng-click directive with RadioButtons.
For illustration purposes this article will explain how to show hide (toggle) HTML DIV on RadioButton click i.e. checked – unchecked or selected – unselected using ng-show and ng-click directives.
Show Hide (Toggle) HTML DIV on RadioButton click using ng-show and ng-click
The below HTML Markup consists of an HTML DIV to which ng-app and ng-controller AngularJS directives have been assigned.
Note: If you want to learn more about these directives, please refer my article Introduction to AngularJS.
The HTML markup consists of an HTML DIV and two RadioButtons. The HTML DIV has been assigned ng-show directive. The value of ng-show directive has been set using the variable IsVisible which is initially set to false and hence the HTML DIV is hidden when page loads.
Note: If you want to learn more about ng-show directive, please refer my article AngularJS ng-show Tutorial.
The RadioButtons have been assigned ng-click directive. When any RadioButton is clicked i.e. checked – unchecked or selected – unselected, the ShowPassport function of the Controller gets called with the respective parameter i.e. Y for Yes RadioButton and N for No RadioButton.
Inside the function, the value of the IsVisible variable is reversed i.e. if it is true then it set to false and vice versa. This makes the HTML DIV toggle when the Yes or No RadioButtons are clicked i.e. checked – unchecked or selected – unselected.
    <script type="text/javascript" src=""></script>
    <script type="text/javascript">
        var app = angular.module('MyApp', [])
        app.controller('MyController', function ($scope) {
            //This will hide the DIV by default.
            $scope.IsVisible = false;
            $scope.ShowPassport = function (value) {
                //If DIV is visible it will be hidden and vice versa.
                $scope.IsVisible = value == "Y";
    <div ng-app="MyApp" ng-controller="MyController">
        <label for="chkPassport">
            Do you have Passport?
            Yes <input type="radio" name="Passport" ng-click="ShowPassport('Y')" />
            No <input type="radio" name="Passport" ng-click="ShowPassport('N')" />
        <hr />
        <div ng-show="IsVisible">
            Passport Number:
            <input type="text" id="txtPassportNumber" />
AngularJS RadioButton ng-click example