[英]Why doesn't root request get the updated index.html
我正在開發一個有角度的應用程序。 每當我修改index.html時,對localhost:8000的請求都不會獲取更新的index.html。 這是為什么? 我正在使用nodejs托管服務器。 假設請求將獲得更新的index.html(例如包括一個新腳本),但我跳了很多遍,但沒有發生任何事情,因為index.html不是更新的腳本。 每次刷新時都非常煩人,我必須鍵入index.html。
app.config(['$locationProvider', '$routeProvider', function ($locationProvider, $routeProvider) {
$locationProvider.html5Mode(true);
$routeProvider.when('/', {
redirectTo : '/login'
}).when('/dashboard', {
templateUrl: 'app/dashboard/dashboard.html',
controller: 'dashboard'
}).when('/login', {
templateUrl: 'app/layout/login.html'
}).when('/register', {
templateUrl: 'app/layout/register.html'
}).otherwise({
redirectTo: '/'
});
}]);
它可能是從瀏覽器緩存中加載的,而不是從服務器中更改后的副本中加載的。
嘗試
location.reload(true)
從服務器加載它。
https://developer.mozilla.org/zh-CN/docs/Web/API/Location.reload
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.