最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

javascript - Uncaught TypeError: this.transitionTo is not a function - Stack Overflow

programmeradmin3浏览0评论

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?

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?

Share Improve this question edited Oct 29, 2015 at 22:42 vinayakj 5,6813 gold badges29 silver badges49 bronze badges asked Oct 29, 2015 at 22:32 mh00hmh00h 1,8563 gold badges27 silver badges45 bronze badges
Add a comment  | 

2 Answers 2

Reset to default 22

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

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

发布评论

评论列表(0)

  1. 暂无评论