Try this <!DOCTYPE html> <html ng-app="myApp"> <head> <script src="https://code.jquery.com/jquery-3.0.0.js"> </script> <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css"></script> <script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.5.6/angular.min.js" rel="stylesheet"></script> <style> li {color: orange; background-color: black; padding: 5px; text-align: center; } </style> <script> var myApp= angular.module("myApp",[]); myApp.controller("myCtrl", function($scope){ $scope.residents= [{fname:"John", lname:"Doe", age:25, alias:"Peter"}, {fname:"Joe", lname:"Mary", age:24, alias:"Paul"}, {fname:"Jay", lname:"Matthew", age:23, alias:"Pan"}] }); $scope.show = false; $scope.counter=0; </script> </head> <body> <div class="container-fluid" ng-controller="myCtrl" > <ul> <li type="none" ng-repeat="resident in residents">{{resident.fname}} {{resident.lname}}, {{resident.age}} <span ng-show='show'> , {{resident.alias}} </span> </li> </ul> <br/> <button type="button" class="btn btn-info" ng-click="show = !show"> <span ng-hide='show'> Click to show pet names </span> <span ng-hide='!show'> Click to hide pet names </span> </button> </div> </body>
</html> Vào 03:57:43 UTC+7 Thứ Ba, ngày 03 tháng 1 năm 2017, Swas Sehgal đã viết: > > <!DOCTYPE html> > <html ng-app="myApp"> > <head> > <script src="https://code.jquery.com/jquery-3.0.0.js"> > </script> > > <script src=" > https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css > "></script> > > <script src=" > https://ajax.googleapis.com/ajax/libs/angularjs/1.5.6/angular.min.js" > rel="stylesheet"></script> > > <style> > li {color: orange; > background-color: black; > padding: 5px; > text-align: center; > > } > </style> > > <script> > var myApp= angular.module("myApp",[]); > myApp.controller("myCtrl", function($scope){ > $scope.residents= [{fname:"John", lname:"Doe", age:25, > alias:"Peter"}, > {fname:"Joe", lname:"Mary", age:24, > alias:"Paul"}, > {fname:"Jay", lname:"Matthew", age:23, > alias:"Pan"}] > }); > $scope.counter=0; > </script> > > </head> > <body> > <div class="container-fluid" ng-controller="myCtrl" > > <ul> > <li type="none" ng-repeat="resident in residents">{{resident.fname}} > {{resident.lname}}, {{resident.age}} </li> > </ul> > <br/> > <button type="button" class="btn btn-info" ng-click="fucn"> Click to > show pet names</button> > > > </div> > </body> > > </html> > -- You received this message because you are subscribed to the Google Groups "Angular" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. Visit this group at https://groups.google.com/group/angular. For more options, visit https://groups.google.com/d/optout.
