基本的角度 - 包括不工作的wamp

时间:2015-02-20 16:38:36

标签: angularjs server

我目前正在学习angularJS。我正在为服务器使用wamp。所有其他angularjs一直有效,直到我到达ng-include。所有文件都在wamp服务器的www目录中。所有链接文件和html都在同一目录中。有什么想法吗?

html main:



<!DOCTYPE html>
<html ng-app="exampleApp">
<head>
    <title>Directives</title>
    <script src="angular.js"></script>
    <link href="bootstrap.css" rel="stylesheet" />
    <link href="bootstrap-theme.css" rel="stylesheet" />
    <script>
        angular.module("exampleApp", [])
            .controller("defaultCtrl", function ($scope) {
                $scope.todos = [
                    { action: "Get groceries", complete: false },
                    { action: "Call plumber", complete: false },
                    { action: "Buy running shoes", complete: true },
                    { action: "Buy flowers", complete: false },
                    { action: "Call family", complete: false }];
            });
    </script>
</head>
<body ng-controller="defaultCtrl">

    <ng-include src="'partial.html'"></ng-include>

</body>
</html>
&#13;
&#13;
&#13;

这是部分我链接到:

&#13;
&#13;
<table class="table">
    <thead>
        <tr>
            <th>#</th>
            <th>Action</th>
            <th>Done</th>
        </tr>
    </thead>
    <tr ng-repeat="item in todos" ng-class="$odd ? 'odd' : 'even'">
        <td>{{$index + 1}}</td>
        <td ng-repeat="prop in item">{{prop}}</td>
    </tr>
</table>
&#13;
&#13;
&#13;

错误:

&#13;
&#13;
XMLHttpRequest cannot load file:///C:/wamp/www/angular-server/chapter%2010/partial.html. Cross origin requests are only supported for protocol schemes: http, data, chrome, chrome-extension, https, chrome-extension-resource.angular.js:9827 (anonymous function)
angular.js:11607 Error: Failed to execute 'send' on 'XMLHttpRequest': Failed to load 'file:///C:/wamp/www/angular-server/chapter%2010/partial.html'.
    at Error (native)
    at file:///C:/wamp/www/angular-server/chapter%2010/angular.js:9827:11
    at sendReq (file:///C:/wamp/www/angular-server/chapter%2010/angular.js:9628:9)
    at serverRequest (file:///C:/wamp/www/angular-server/chapter%2010/angular.js:9344:16)
    at processQueue (file:///C:/wamp/www/angular-server/chapter%2010/angular.js:13189:27)
    at file:///C:/wamp/www/angular-server/chapter%2010/angular.js:13205:27
    at Scope.$eval (file:///C:/wamp/www/angular-server/chapter%2010/angular.js:14401:28)
    at Scope.$digest (file:///C:/wamp/www/angular-server/chapter%2010/angular.js:14217:31)
    at Scope.$apply (file:///C:/wamp/www/angular-server/chapter%2010/angular.js:14506:24)
    at bootstrapApply (file:///C:/wamp/www/angular-server/chapter%2010/angular.js:1448:15)angular.js:11607 (anonymous function)
file:///C:/wamp/www/angular-server/chapter%2010/bootstrap.css.map Failed to load resource: net::ERR_FILE_NOT_FOUND
file:///C:/wamp/www/angular-server/chapter%2010/bootstrap-theme.css.map Failed to load resource: net::ERR_FILE_NOT_FOUND
&#13;
&#13;
&#13;

0 个答案:

没有答案