Reputation: 3272
I have a route I want to be able to navigate in series. Unfortunately Backbone doesn't make it possible to navigate the same route twice.
Is it possible not to save this route to the history?
I have this route:
app_router.on('route:deleteFile', function(filename){
var r=confirm("Do you really want to delete "+filename);
if (r==true)
{
//delete instruction
}
});
If I don't accept the confirm by mistake, I can't choose the same file to delete again. Because the route is already reached.
Upvotes: 0
Views: 184
Reputation: 4129
One solution consist of navigating to the previous route when you don't accept the confirm, without triggering it :
app_router.on('route:deleteFile', function(filename){
var r=confirm("Do you really want to delete "+filename);
if (r==true)
{
//delete instruction
}
else
{
Backbone.history.navigate(/* previous rout */, {trigger: false});
}
});
Upvotes: 1