I've just upgraded to the latest ember and the following code is breaking, I have a number of these actions defined on the router
App.Router = Em.Router.extend
showUser: Ember.Route.transitionTo('root.users.user')
with the following error message
Uncaught TypeError: Object Ember.Route has no method 'transitionTo'
There is nothing in the changelog about this change but it has been removed from the Route class. It still exists on the instance.
How else can I define actions like these on the router which I can call from elsewhere?
Recently ember introduced a new router. Their guides got pretty mature, so please check these how to implement your routings.
In short:
App.Router.map(function(match) {
match('/').to('index');
match('/posts').to('posts');
});
App.IndexRoute = Ember.Route.extend({
redirect: function() {
this.transitionTo('posts');
}
});
If you're building from master you will find ember-old-router.js
in the dist directory which will allow your code based on the "old" router to continue to run while you transition to the new way of doing things.
To get an idea of how things are now check out this gist or the official site's guide section.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With