我正在尝试学习 Angular.js,并且我有一个简单的小提琴,应该可以根据教程工作(至少我认为应该),但显然它没有。
'data-ng-controller' 之前的指令有效,但之后的相同指令失败。谢谢。
我尝试过驼峰式变体和传统的 ng 指令变体。根据文档 - data-ng-directive 作为 html 验证的解决方法应该是有效的。
html:
<div ng-app="">
<h3>{{ "test" }}</h3>
<div data-ng-controller="ItemListCtrl">
<ul>
<li data-ng-repeat="item in items">
{{ item.description }}
</li>
</ul>
<h3>{{ "test" }}</h3>
</div>
</div>
js:
function ItemListCtrl ($scope) {
$scope.items = [
{ "description": "coffee pot" },
{ "description": "nerf gun" },
{ "description": "phone" }
];
}