javascript - checkBox ng-Repeat from controller-data not Rendering : AngularJs -
i picking checkbox data controller file, not rendering properly. following html:
html:
<html> <head> <script src="http://ajax.googleapis.com/ajax/libs/angularjs/1.4.8/angular.min.js"></script> </head> <body ng-app="myapp" ng-controller="myctrl"> <table> <tr ng-repeat="x in people"> <input type="checkbox" id="{{x.id}}" >{{x.name}}<br/> </tr> </table> <button>click</button> <script> //module declaration var app = angular.module('myapp',[]); //controller declaration app.controller('myctrl',function($scope){ $scope.people = [ {name:"peter",id:"201"}, {name:"lina",id:"202"}, {name:"roger",id:"203"} ]; }); </script> </body> </html>
expectation:
3 rows of input checkboxes names adjescent them
result:
there no js errors. can me out wrong in this?
just add "td" tag : jsfiddle
<html> <head> <script src="http://ajax.googleapis.com/ajax/libs/angularjs/1.4.8/angular.min.js"></script> </head> <body ng-app="myapp" ng-controller="myctrl"> <table> <tr ng-repeat="x in people"> <td> <input type="checkbox" id="{{x.id}}" >{{x.name}}<br/> </td> </tr> </table> <button>click</button> <script> //module declaration var app = angular.module('myapp',[]); //controller declaration app.controller('myctrl',function($scope){ $scope.people = [ {name:"peter",id:"201"}, {name:"lina",id:"202"}, {name:"roger",id:"203"} ]; }); </script> </body> </html>
Comments
Post a Comment