I’ve been trying to get my head around this one. I created an action like this:
Contributionkeeper.RepositoriesController = Ember.Controller.extend({
actions: {
delete: function(repo) {
Ember.$.ajax({
url: '...',
success: function(data) { },
error: function() {
//TODO: Raise error
});
}
}
});
I want the application to navigate to an error substate. But I haven’t found a way to do so from my action. How can I fix this?
1 Like
It turns out that right now, there’s no way to trigger the substate from within your application. I really wished that there was a way, but there isn’t.
To fix the problem I changed my code to look like this:
Contributionkeeper.RepositoriesController = Ember.Controller.extend({
var controller = this;
actions: {
delete: function(repo) {
Ember.$.ajax({
url: '...',
success: function(data) { },
error: function() {
controller.transitionToRoute('application-error');
});
}
}
});
That is good enough for my application since I don’t want to disclose any specifics about the error. The details are logged on the server, so I have access. The user just needs a message that something’s up and that we’re looking into it. This route just does that