as Mike Aski answered on this question at stackoverflow:
its considered bad practice to transition to another route from a controller.
is it true?
if so, what will be a better approach?
App.CreateReviewController = Ember.Controller.extend({
createReview : function () {
var review = App.Review.createRecord({
author : this.get('author'),
text : this.get('text')
});
review.save();
// transition from the controller, is it bad?
this.transitionToRoute('reviews');
}});
I personally don’t find anything wrong with this, however just so you know you can also put this into the route in the events hash and use transitionTo.
Use of transitionTo in the controllers is deprecated. If you want to do a transition from a controllers you should use transitionToRoute and if you need to transition from one route to another you should use transitionTo
I do this all the time in my app. I frequently end up navigating users way after a save or other async action has happened inside of a controller. It seems silly to send an event to the router only to have the router just call transition, when you could just transition from the controller. Just my $0.02.