在Angular.js路由上阅读了大量的报告和stackoverflow问题之后,当我进行手动刷新时,我仍然收到"未找到"错误.
脚步:
localhost- >因为我的配置(下面),我被带到了localhost/home.视图和一切都很好.Not Found: the requested /home is not found on this server这个问题可能最像刷新页面给出"找不到页面"
我的配置
// Routing configuration.
angular.module('myModule')
.config(['$routeProvider', '$locationProvider',
function ($routeProvider, $locationProvider) {
// Enable pushState in routes.
$locationProvider.html5Mode(true);
$routeProvider
.when('/home', {
templates: {
layout: '/views/home.html'
},
title: 'Welcome!'
})
.when('/launchpad', {
templates: {
layout: '/views/layouts/default.html',
content: '/views/partials/profile.html'
},
title: "Launchpad"
})
.otherwise({
redirectTo: '/home'
});
}
]);
Run Code Online (Sandbox Code Playgroud)
我做过的其他事情:
index.html,我已经有了<base href="/">这是我尝试过的htaccess规则.没有工作.
我本来希望绑定<svelte:window>但没有运气。
<!-- doesn't work -->
<svelte:window on:beforeunload={() => true} />
<!-- doesn't work -->
<svelte:window on:onbeforeunload={() => true} />
<!-- doesn't work -->
<svelte:window on:beforeUnload={() => true} />
Run Code Online (Sandbox Code Playgroud)
在所有情况下,window.onbeforeunload都是null
我最终只是继续,window.onbeforeunload = () => true但想知道为什么元素上的设置不起作用。