2013-09-30 92 views
1

我以前做這樣的事情就燼RC7發現錯誤(404):灰燼1.0路由器,嘗試捕捉上handleURL

App.Router.reopen({ 
    handleURL: function(url) { 
     try { 
      return this._super(url); 
     } catch (error) { 
      console.log('error'); 
     } 
    } 
}); 

曾經工作過的漁獲物,但它不工作了。

有一個「路由器改造」,但我不明白它是如何打破的;以及如何捕捉404現在。在路由的activate()deactivate()

App.Router.map(function() { 
    this.route("404", { 
     path: "*:" 
    }); 
}); 

你應該能夠然後堅持自定義代碼(如您的console.log()):

+0

可能重複[如何處理Ember.js中的'無路由匹配'並顯示404頁面?](http://stackoverflow.com/questions/14548594/how-to-handle-no-route-matched-在-燼-JS-和秀-404頁) –

回答

3

只需設置一個404路在你的路由器是這樣的。