0
我真的被卡住了。無法理解,爲什麼我無法輸出服務器響應。無法從服務器響應(WebAPI)獲得輸出(AngularJS)
的index.html的代碼部分
<table class="table" ng-controller="FileListCtrl">
<thead>
<tr>
<td>Less 10Mb</td>
<td>10Mb - 50Mb</td>
<td>More 100Mb</td>
</tr>
</thead>
<tbody>
<tr>
<td>{{smallFiles}}</td>
<td>{{averageFiles}}</td>
<td>{{bigFiles}}</td>
</tr>
</tbody>
</table>
fileListCtrl.js
(function()
{
"use strict";
angular
.module("fileManagement")
.controller("FileListCtrl",
["fileResource",
FileListCtrl]);
function FileListCtrl(fileResource){
fileResource.get();
}
}
());
不fileResource.get返回一個承諾?如果是的話,那就試試。 - > 功能FileListCtrl(fileResource,$範圍){ fileResource.get(),然後(函數(responseData){$ = scope.smallFiles responseData.smallFiles; }) 。} – BuriB