ng-click
1 <!DOCTYPE html> 2 <html ng-app="json"> 3 <head> 4 <meta charset="utf-8"> 5 <script src="angular-1.0.1.min.js"></script> 6 <title></title> 7 </head> 8 <body> 9 <div ng-controller="ceshi"> 10 <li ng-repeat="js in jsons">{{js.name}}-{{js.city}}</li> 11 <button ng-click="jsonclick()">测试</button> 12 </div> 13 </body> 14 </html> 15 16 <script> 17 var json=angular.module('json',[]); 18 json.controller('ceshi',function($scope,$http){ 19 20 $scope.jsonclick=function(){ 21 $scope.jsons=[ 22 {name: 'John Smith', city: 'Phoenix'}, 23 {name: 'John Doe', city: 'New York'}, 24 {name: 'Jane Doe', city: 'San Francisco'} 25 ]; 26 }; 27 }); 28 29 </script>