angularJs小Demo

<!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>

猜你喜欢

转载自songfeng-123.iteye.com/blog/2342081
今日推荐