嗨數據我試圖從我的角度網絡API獲取數據,但我得到404未找到代碼角可以從網絡API
HTML代碼
<!DOCTYPE html>
<html ng-app="myApp">
<head>
<meta charset="utf-8" />
<title>Simple Web Application</title>
<script src="Scripts/angular.js"></script>
<script src="Scripts/script.js"></script>
</head>
<body >
<div ng-controller="MainController">
<table>
<tr>
<td>ID</td>
<td>Name</td>
</tr>
<tr ng-repeat="emp in employees">
<td>{{emp.id}}</td>
<td>{{emp.Ename}}</td>
</tr>
</table>
</div>
</body>
</html>
角代碼:
var url = "http://localhost:65125/api/Empyloee";
var myApp = angular.module("myApp", []);
var MainController = function ($scope, $http) {
var onSucess = function (response) { $scope.employees = response.data};
var onFailure = function (reason) { $scope.error = reason };
var getAllEmployees = function() {
$http.get(url)
.then(onSucess ,onFailure)
};
getAllEmployees();
};
myApp.controller("MainController", MainController);
感謝您的幫助
請更正您的問題 - 粘貼代碼在這裏,更具體。 –
控制檯中的任何錯誤?如果你能夠從API獲取數據,請檢查網絡控制檯.. –
控制檯顯示404找不到與郵差工作沒有任何問題 – Zcode