我在移动平台类固醇,angular.js和firebase.js上写了一个应用程序.最近我遇到了这样的问题:页面没有加载,因为它试图访问一个奇怪的url文件:// 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):
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:'/'}); });
所以问题可能在于html5Mode.我的问题是:如何在app.js中修复路由?该项目的完整代码如下:https://github.com/patut/SCBI.