代码
<!DOCTYPE html>
<html lang="en" ng-app="app">
<head>
<meta charset="UTF-8">
<title>Angular-$http</title>
</head>
<body ng-controller="MainCtrl as mainctrl">
<table width="200" border="2" >
<tr>
<th>编号</th>
<th>姓名</th>
</tr>
<tr ng-repeat="item in mainctrl.data">
<td>{{item.sid}}</td>
<td>{{item.name}}</td>
</tr>
</table>
<script type="text/javascript" src="angular.min.js"></script>
<script type="text/javascript">
var app = angular.module("app",[]);
app.controller("MainCtrl",["$http",function($http){
var that=this;
$http.get("stu.json").then(function(result){
that.data = result.data.list;
});
}]);
</script>
</body>
</html>
stu.json
{
"list": [{
"sid": "001",
"name": "冷月心"
},
{
"sid": "002",
"name": "莫山山"
},
{
"sid": "003",
"name": "叶红鱼"
}
]
}