我正在用angularJS在頁面之間導航,但是當我打開主頁時與我的瀏覽器,它不顯示任何內容 當我在控制檯看,我看到這個錯誤:AngularJS錯誤只有協議方案支持跨源請求:http,data,chrome,chrome-extension,https,chrome-extension-resource
Cross origin requests are only supported for protocol schemes: http, data, chrome, chrome-extension, https, chrome-extension-resource.
這裏是我的代碼:
ViewsTestPage:
<html>
<head>
<title>Views Test</title>
<script src="angular.min.js"></script>
<script src="angular-route.min.js"></script>
<script src="controller.js"></script>
</head>
<body ng-app="myApp">
<div ng-view></div>
</body>
</html>
個
的controller.js:
var mainApp = angular.module('myApp', ['ngRoute']);
mainApp.config(function($routeProvider){
$routeProvider
.when('/', {
templateUrl: 'UsersPage.html'
})
.when('/helloUser', {
templateUrl: 'hello.html'
})
.otherwise({
redirectTo: '/'
});
});
UsersPage:
Hello world <a href="#/helloUser">Hi users</a>
hello.html的
<h1> Users Page</h1>
任何幫助,請我'begginner !!!!
我看到了這個迴應,但我不知道該怎麼做,你能展示更多,我有什麼步驟做??? –
您是否安裝了節點或安裝了webstorm? – sumair