<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title></title>
<script type="text/javascript" src="../js/angular.js" ></script>
<script>
var app = angular.module("myApp",[]);
app.controller("myCtrl",function($scope,$http){
//$scope.haha = 3;
$http({//请求参数
method:"get",
url:"myJson.json"
}).then(function success(response){
console.log(response);
console.log(response.data);
$scope.arr = response;
$scope.name = response.data[2].name;
},function error(){
$scope.name = "error";
});
});
</script>
</head>
<body ng-app="myApp" ng-controller="myCtrl">
<!--{{arr}}-->
<ul ng-repeat="user in arr.data">
<p>姓名:{{user.name}},年龄:{{user.age}},性别:{{user.sex}}</p>
</ul>
</body>
</html>
[{"name":"张三","age":20,"sex":"男"},
{"name":"李四","age":21,"sex":"女"},
{"name":"王五","age":22,"sex":"男"}]