2017-10-09 66 views
0
刷新頁面後,「不能讓錯誤」

此錯誤開始顯示自己我加$locationProvider.html5Mode(true)我的狀態配置上AngularJS後:與html5mode

'Cannot GET error' after refreshing page with html5mode

I`ve搜索了一下,發現此修復程序到服務器端,但它不會是因爲某些JSON錯誤的工作:(也許有人知道如何正確地解決它不用其他製造新的錯誤)

app.get('*', function(req, res) { 
    res.sendFile(__dirname + '/public/index.html'); 
}); 
+0

您可以顯示至少使用一個錯誤嗎? – 31piy

+0

'位置0的JSON中出現意外的標記'此錯誤顯示出來,當我將res.sendFIle添加到後端站點時 – rebilliony

+0

另外,當我刪除html5Mode和res.sendFile時,所有工作都正確,除了#!在URL .. – rebilliony

回答

0

試着改變你的代碼下面:

app.all('/*', function(req, res) { 
    res.sendFile('index.html', { root: __dirname + '/public/index.html' }); 
}); 
+0

仍然是同樣的錯誤:( – rebilliony

+0

你可以用你的代碼創建一個小提琴 –

+0

我不能,它是一個大的應用程序粘貼 – rebilliony

相關問題