Search This Blog

<!DOCTYPE html>
<html>
<head>
<title></title>
<script type="text/javascript" src="angular.min.js"></script>
</head>
<body>
<div ng-app="myapp" ng-controller="myctrl">

<div ng-repeat="c in course">
    <label><input type="checkbox" ng-model="msg.selected[c]" ng-true-value="'{{c}}'" ng-false-value="''">{{c}}</label>

</div>
     <input type="button" value="Click" ng-click="fun()" />
{{res}}
</div>

<script type="text/javascript">

  var app = angular.module('myapp',[]);
   app.controller('myctrl',function($scope)
   {
      $scope.msg = {
    selected:{}
};
     $scope.course = [
 "C","CPP","JAVA",".NET","PHP","iOS","Android"
];
      $scope.fun=function()
      {
        a =$scope.msg.selected;
          data='';
           for (var key in a) {
     
                data=data+a[key]+" ";
        }
          $scope.res =data;
      }
   }

    )

</script>
</body>
</html>


Post a Comment

If you have any doubt in programming or join online classes then you can contact us by comment .

Previous Post Next Post