Angularjs I';我正在尝试使用angular在我的页面index.html上显示模型中的文档列表
以下是我的文件app.js的内容:Angularjs I';我正在尝试使用angular在我的页面index.html上显示模型中的文档列表,angularjs,spring,Angularjs,Spring,以下是我的文件app.js的内容: var app=angular.module("Doc",[]); app.controller("DocController",function($scope,$http){ $scope.documents=[]; $http.get("/all") .success(function(data){ $scope.documents=data; }); }); 和我的页面index.html: <body ng-app="Doc"
var app=angular.module("Doc",[]);
app.controller("DocController",function($scope,$http){
$scope.documents=[];
$http.get("/all")
.success(function(data){
$scope.documents=data;
});
});
和我的页面index.html:
<body ng-app="Doc" ng-controller="DocController">
<table>
<thead>
<tr>
<th>REF</th><th>NAME</th>
</tr>
</thead>
<tbody>
<tr ng-repeat="k in documents">
<td>{{k.dref}}</td>
<td>{{k.dname}}</td>
</tr>
</tbody>
</table>
<script type="text/javascript" src="angular/angular.min.js"></script>
<script type="text/javascript" src="js/app.js"></script>
</body>
参考名称
{{k.dref}}
{{k.dname}}
但当我运行我的应用程序时,我没有得到列表,它只显示以下内容:
参考名称
就像在我的html页面中一样:
<th>REF</th><th>NAME</th>
REFNAME
尝试控制台数据,查看api是否返回文档,如果是,返回的格式是什么。非常感谢,我这样做了,并发现此错误:“$http.get(…)。success不是一个函数”,然后我发现它被替换为“.then”在最新版本中,