0
我正在做角度路由並出現此錯誤。使用角度路由時出現錯誤只有協議方案支持跨域請求:http
這是我的html文件
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<script src="../Scripts/angular.min.js"></script>
<script src="../Scripts/angular-route.min.js"></script>
<script src="../Scripts/test.js"></script>
<script src="../Controllers/about.js"></script>
<script src="../Controllers/contact.js"></script>
<script src="../Controllers/home.js"></script>
</head>
<div ng-app="MyApp">
<body>
<div class="navbar-header">
<nav>
<ul>
<li><a href="#!/">Home</a></li>
<li><a href="#!/about">About Us</a></li>
<li><a href="#!/contact">Contact Us</a></li>
</ul>
</nav>
</div>
<div ng-view>
</div>
</body>
</div>
</html>
這是我的js文件。
var myapp= angular.module('MyApp',['ngRoute']);
myapp.config(function($routeProvider) {
$routeProvider
.when('/',{
templateUrl: 'home.html',
controller: 'mainController'
})
.when('/about',{
templateUrl: 'about.html',
controller: 'aboutController'
})
.when('/contact',{
templateUrl: 'contact.html',
controller: 'contactController'
});
});
的可能的複製[AngularJS錯誤:交叉原點請求僅支持的協議方案:HTTP,數據,鉻延伸,HTTPS(https://stackoverflow.com/questions/ 27742070/angularjs誤差交原點請求-是僅支持換協議的方案) –