I have a control set up like this:
- Renders a view loaded async.
- Data for the view is also loaded asynchronously.
- Listens to route changes. One of the route handler displays a modal with the details of a model loaded in step 2.
The problem is that the user might get to a page that has a route that point to a model, that is not available at the moment the control is initialized so, obviously, the modal is not loaded.
can.Control({
init: function() {
can.view('file.ejs', {pages: app.Model.Page.findAll()}, function(frag){
// inject the fragment into DOM
});
},
'page/:id/comments route': function() {
// find the page in the list of models loaded, than display the modal
}
});
How to I trigger the distcher again or make the controller go over the routes after the view is rendered?