我正在与pro angularjs图书一起学习角度,但是很早就迷迷糊糊了:我无法从显示的json文件中获取数据。这是HTML:
Column
这是json文件:
sudo /usr/lib/rabbitmq/bin/rabbitmq-server
该表不显示任何内容。
我读到<!DOCTYPE html>
<html ng-app="demo">
<head>
<title>Example</title>
<script src="angular.js"></script>
<link href="bootstrap.css" rel="stylesheet" />
<link href="bootstrap-theme.css" rel="stylesheet" />
<script type="text/javascript">
var myApp = angular.module("demo", []);
myApp.controller("demoCtrl", function($scope, $http) {
var promise = $http.get("todo.json");
promise.success(function(data) {
$scope.todos = data;
});
});
</script>
</head>
<body ng-controller="demoCtrl">
<div class="panel">
<h1>To Do</h1>
<table class="table">
<tr><td>Action</td><td>Done</td></tr>
<tr ng-repeat="item in todos">
<td>{{item.action}}</td>
<td>{{item.done}}</td>
</tr>
</table>
</div>
</body>
</html>
已过时,改用[{ "action": "Buy Flowers", "done": false },
{ "action": "Get Shoes", "done": false },
{ "action": "Collect Tickets", "done": true },
{ "action": "Call Joe", "done": false }]
,就像这样:
.success
现在,我的表格中有6个空行。请帮忙:)