While writing my first app in Ember.js I I ran into a problem where I wanted to execute an action through calling some API with jQuery. When this call fails, I want the page to be redirected to the error state.
My code
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
});
}
}
});
Question
I want the application to navigate to an error substate. How can I fix this?
Aucun commentaire:
Enregistrer un commentaire