Skip to content

Instantly share code, notes, and snippets.

@xcambar
Created December 19, 2014 12:33
Show Gist options
  • Save xcambar/69b5b23f8156de5b08d2 to your computer and use it in GitHub Desktop.
Save xcambar/69b5b23f8156de5b08d2 to your computer and use it in GitHub Desktop.
Ember simple redirect to error
App.AuthenticatedRoute = Ember.Mixin.create({
beforeModel: function () {
var isUserConnected = false;
if (!isUserConnected) {
throw new Error('Fail');
}
}
});
App.IndexRoute = Ember.Route.extend(App.AuthenticatedRoute, {
beforeModel: function() {
this._super(); // Don't forget that, or your mixins won't be called
this.transitionTo("documents");
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment