这里有一些不起作用的代码,我不知道为什么。有谁可以帮助我?
<!DOCTYPE html>
<html>
<head data-ng-app="">
<title>Directives and Data Binding angular_js</title>
</head>
<body data-ng-init="names=['John Smith','John Doe','Jane Doe']">Name:
<br/>
<input type="text" data-ng-model="name" />{{ name }}
<ul>
<li data-ng-repeat="person in names"></li>
</ul>
<script src="angular.min.js"></script>
</body>
</html>
http://postimg.org/image/pi38k566f/
我正在使用Opera,我也试过Mozilla Firefox。
答案 0 :(得分:0)
这有效 - Plunker
data-ng-app=""
应该在正文标记中:
<!DOCTYPE html>
<html>
<head>
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.3.15/angular.min.js"></script>
<title>Directives and Data Binding angular_js</title>
</head>
<body data-ng-app="" data-ng-init="names=['John Smith','John Doe','Jane Doe']">
Name:<br/><input type="text" data-ng-model="name"/>{{ name }}
<ul>
<li data-ng-repeat="person in names">{{person}}</li>
</ul>
</body>
</html>
我在重复中添加了{{person}}
以显示数组数据。