angularJs小Demo

前端之家收集整理的这篇文章主要介绍了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>
原文链接:https://www.f2er.com/angularjs/148518.html

猜你在找的Angularjs相关文章