2015-10-29 10 views
5

ではない、私はちょうどember 2.1に自分のアプリケーションをアップグレードし、私のWebブラウザコンソールでこのエラーを取得しています:キャッチされない例外TypeError:this.transitionToが機能

:私のURLで

Uncaught TypeError: this.transitionTo is not a function 

、私はdirectionという名前の変数を持っています

http://localhost:4200/plates/new?direction=plates 

その後、私は私のコントローラにこれを構築する:

export default Ember.Controller.extend({ 
    queryParams: ['direction'], 
    direction: null, 
    actions: { 
     lastpage(){ 
      this.transitionTo(this.get('direction')); 
      }, 
     save(...){ 
      }, 

     }, 
    }); 

このU私のアップグレードの前に働くことを頼んだ。何が価値を下げた/私はこのエラーを修正するのですか?

答えて

16

this.transitionToの代わりにthis.transitionToRouteを使用する必要があります。これは1.xの大部分で非推奨になりました。

3

Controllerは、方法がありませんtransitionToです。方法はRouteです。コントローラにはメソッドtransitionToRouteがあります。