2013-08-22 215 views
0

後不能正常工作,請參閱此功能JSBin:http://jsbin.com/acUm/20Ember.js歷史transitionTo

這裏是我工作的行爲。如果我輸入'Monroe'來過濾列表,然後點擊瀏覽器後退按鈕,我希望Ember能夠處理路線並向所有患者發出請求。相反,它似乎什麼都不做。由於後退按鈕似乎適用於其他區域,因此特別混亂。

也許我設置了這個過渡不當嗎?或者這是一個Ember.js錯誤?

+0

UPDATE:http://jsbin.com/acUm/28/edit?html,js,output。在搜索並加載'/ filtered /:last_name'路線後,甚至沒有linkTo幫助程序工作。 WTF? – jasongonzales

回答

2

當你轉換到路由時,在層次結構中使用childest路由是一個好主意。

你的情況,你有這樣的:

this.resource('patients', { path: '/' }, function() { 
    // this is created for you 
    // this.route('index'); 
    this.route('filtered', { path: '/filtered/:last_name' }); 
}); 

默認情況下,創建了該資源的路徑標識,讓你有patients.index。 但是你的轉換轉到patients,它不是最簡單的。

所以要更正此問題,我已將您的示例更改爲使用PatientsIndex[Controller,Router etc]而不是Patients[Controller,Router etc]

工作演示http://jsbin.com/acUm/24/edit

+0

幹得好! Ember很簡單,如果你明白它是如何要你做的事:) – jasongonzales

+0

@Marcio Junior有沒有其他的方式來解決問題,而不是使用索引路線? –