Ng-Value-1

 

Selected category with ng-value bind to my.favourite which display the text with selected category.

 
 
 
<!DOCTYPE html> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <title>Welcome to LearnKode - A code learning platform</title> <script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.4.2/angular.min.js"></script> </head> <body ng-app="app"> <h3>Which is your favorite ?</h3> <div ng-controller="controllerName"> <div ng-repeat="category in categories"> <input type="radio" ng-model="my.favorite" ng-value="category" name="learnIt"> {{category}} </div> <pre>You Selected:{{my.favorite}}</pre> </div> <script> var app = angular.module("app", []); app.controller('controllerName', ['$scope', function ($scope) { $scope.categories = ['AngularJs', 'Jquery', 'Bootstrap', 'JavaScript']; $scope.my = { favorite: 'AngularJs' }; }]); </script> </body> </html>
Output