- <!DOCTYPE html>
- <html>
- <head>
- <Meta charset="utf-8">
- <script src="http://cdn.static.runoob.com/libs/angular.js/1.4.6/angular.min.js"></script>
- </head>
- <body>
-
- <div ng-app="myApp" ng-init="names=['Jani','Hege','Kai']" ng-controller="myCtrl">
- <p>使用 ng-repeat 来循环数组</p>
- <ul>
- <input ng-model="name" ng-init="name=111">
- <li ng-click="clickMe($event,x)" ng-repeat="x in names">
- {{ x }}
- </li>
- </ul>
- </div>
-
- <script>
- var app = angular.module("myApp",[]);
- app.controller('myCtrl',function($scope) {
- $scope.name = "songfeng";
- $scope.clickMe = function(obj,value){
- console.info(obj.target.innerHTML+","+value);
- }
- });
- </script>
- </body>
- </html>