Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/html/70.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Angularjs 如何修复应用程序中的angular.js路由?_Angularjs_Html_Url Routing_Angular Routing_Ngroute - Fatal编程技术网

Angularjs 如何修复应用程序中的angular.js路由?

Angularjs 如何修复应用程序中的angular.js路由?,angularjs,html,url-routing,angular-routing,ngroute,Angularjs,Html,Url Routing,Angular Routing,Ngroute,我正在移动平台类固醇、angular.js和firebase.js上编写一个应用程序。最近我遇到了这样的问题:页面无法加载,因为它试图访问一个奇怪的urlfile://file:///Users/patutinskijfedor/Desktop/firebase/WILLY/www/ Error: Failed to execute 'replaceState' on 'History': A history state object with URL 'file://file:///Users

我正在移动平台类固醇、angular.js和firebase.js上编写一个应用程序。最近我遇到了这样的问题:页面无法加载,因为它试图访问一个奇怪的url
file://file:///Users/patutinskijfedor/Desktop/firebase/WILLY/www/

Error: Failed to execute 'replaceState' on 'History': A history state object with URL 'file://file:///Users/patutinskijfedor/Desktop/firebase/WILLY/www/' cannot be created in a document with origin 'null'.
我在互联网上读到了这个问题,并意识到我的问题是角度路由。它看起来像这样(文件
app.js
):


因此问题可能出在
HTML5模式上。我的问题是:如何在
app.js
中修复路由?项目的完整代码如下:

如果HTML5页面中提到的基本URL不正确,则可能发生这种情况。
请在此处共享您的基本URL

这可能是由该
file://file:///
?不应该存在简单的
file://
或更好的
locahost
…您是使用Node来托管此站点,还是只是在文件系统之外运行站点?看起来类似于您是否可以尝试将“/”添加到模板URL,如/teachers.html等。?
angular.module('SCBI', ['SCBI.controllers','ngRoute']).config(function($routeProvider, $locationProvider){
    $locationProvider.html5Mode(true);

    $routeProvider.when('/teachers',{ templateUrl: 'teachers.html'});
    $routeProvider.when('/teachers/:id', {templateUrl: 't.html', controller: 'TeachersListController'});
    $routeProvider.when('/', {templateUrl: 'authorization.html', controller: 'AuthorizationController'});
    $routeProvider.otherwise({redirectTo:'/'});
});