AngularJS Radio Buttons

AngularJS Radio Buttons

Hello everyone, I am going to share the code-sample of how to use the ng-checked with ng-model in angularjs radio buttons. The example code as given below.

Radio Buttons ng-checked with ng-model.

Go to link for AngularJs Radio Buttons in ng-repeat 
http://www.code-sample.com/2015/06/radio-button-list-in-ng-repeat-angularjs.html

The HTML code-sample

<form ng-repeat="adon in myAddOns">
    <input type="radio" id="addons-no" name="none{{$index}}" ng-model="adon.ADDONS" ng-value="false" ng-checked="false"> None     <br />
    <input type="radio" id="addons-yes" name="notnone{{$index}}" ng-model="adon.ADDONS" ng-value="true" ng-checked="true"> {{adon.DISPLAYNAME}}
</form>

The AngularJs code sample

    $scope.myAddOns = null;//Default value

    $scope.getAddOns = function (mobile) {
        getSubServices.getAddOns(mobile).then(function (resp) {
            if (resp) {
                if (resp.data) {                  
                    $scope.myAddOns = resp.data;
                }
            }
        });      

    };

Thank you!
ANIL SINGH

Hey! I'm Anil Singh. I author this blog. I'm Active Blogger, Programmer. I love learning new technologies, programming, blogging and participating the forum discussions more...
My Blogs - http://www.code-sample.com and http://www.code-sample.xyz
My Books - Google Amazon and Flipkart Book Store!

You Might Also Like
Post a Comment
www.code-sample.com/. Powered by Blogger.
ASK Questions
SQL Server NodeJs TypeScript JavaScript Angular SQL Server My Book