Angularjs HTTP返回状态0的错误

时间:2015-03-24 11:17:59

标签: angularjs angularjs-http

我是angularjs的新手,每当我请求从服务器获取数据时,我都会收到错误状态0.有人可以指出,我的代码有什么问题。

  • HTTPGET

  • 1000多个条目的巨大数据

  • WCF RESTFull服务

的index.html

<!DOCTYPE html>
<html>
<head>
    <style>
        table, th, td {
            border: 1px solid grey;
            border-collapse: collapse;
            padding: 5px;
        }

            table tr:nth-child(odd) {
                background-color: #f1f1f1;
            }

            table tr:nth-child(even) {
                background-color: #ffffff;
            }
    </style>
    <script src="http://ajax.googleapis.com/ajax/libs/angularjs/1.3.14/angular.min.js"></script>
</head>

<body>

    <div ng-app="myApp" ng-controller="customersCtrl">

            <table>
                <tr ng-repeat="client in Clients">

                    <td>{{ client.id}}</td>
                    <td>{{ client.name }}</td>
                </tr>
            </table>

</div>


</body>
</html>

脚本

<script>
        var app = angular.module('myApp', []);

        app.controller('customersCtrl', function ($scope, $http) {
            $http.get("http://localhost:8080/Clients.svc/getclients&clinetid=?")
            .success(function (data, status, headers, config) {
                $scope.Clients = data.clients;
            })
            .error(function (data, status, headers, config) {
                alert(status);
            });
        });
    </script>

0 个答案:

没有答案