Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Uncaught TypeError: this.transitionTo is not a function

I just upgraded my application to ember 2.1 and am getting this error in my web browser console:

Uncaught TypeError: this.transitionTo is not a function

In my url, I have a variable named direction:

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

Then I build this into my controller:

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

        },  
    }); 

This used to work before my upgrade. What depreciated / how do I fix this error?

like image 920
mh00h Avatar asked Oct 29 '15 22:10

mh00h


2 Answers

From a controller you need to use this.transitionToRoute instead of this.transitionTo. This has been deprecated for much of 1.x.

like image 179
runspired Avatar answered Nov 16 '22 09:11

runspired


Controller does not have a method transitionTo. It is a method of Route. Controller has method transitionToRoute.

like image 31
Orest Hera Avatar answered Nov 16 '22 11:11

Orest Hera