我对 AngularJS 和 JavaScript 非常陌生。我正在完成的一个教程是迭代一些名称,但由于某种原因它不起作用。关于做什么的任何建议?下面是我的代码。
<!doctype html>
<html lang="en" ng-app ng-controller="MainCtrl">
<head>
<meta charset="utf-8">
<title>Learning AngularJS: Controllers</title>
</head>
<body>
<h1>The People App</h1>
<h4>View People</h4>
<ul>
<li ng-repeat="person in people">
from ,
</li>
</ul>
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.0.7/angular.min.js"></script>
<script>
function MainCtrl($scope) {
$scope.people = [{
name: 'John Doe',
city: 'New York City',
state: 'New York'
},{
name: 'John Smith',
city: 'Oklahoma City',
state: 'Oklahoma'
},{
name: 'Henry Black',
city: 'Topeka',
state: 'Kansas'
}];
}
</script>
</body>
</html>