![](/img/trans.png)
[英]How to get the first URL different of the current URL in route history?
[英]How to translate the url to the right route when the locationtype = history in emberjs?
我編寫了一個簡單的emberjs應用程序,並將路由器位置類型設置為“歷史”
所以我得到一些網址
http:// localhost /#/ post / 1
至
由emberjs在本地更改的網址
但是,當我刷新頁面時,出現錯誤
Cannot GET /post/1
似乎nodejs無法識別該URL
因此,我想知道如何將絕對URL重新映射到路由?
你能給我一些提示嗎?
謝謝
您可以將其放在app.js的ajaxSetup中,如下所示:
Ember.$.ajaxSetup( {
beforeSend : function (xhr)
{
this.url = 'http://localhost' + this.url;
},
dataType : // e.g.'json',
contentType: // e.g.'application/json',
crossDomain: true
});
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.