flatiron / director

a tiny and isomorphic URL router for JavaScript
http://github.com/flatiron/director
MIT License
5.6k stars 486 forks source link

is it possible to change url and render view after load data from server? #274

Open train860 opened 9 years ago

train860 commented 9 years ago

In fact,I want to make my app works like angularjs's resolve,load data from server complete,then change url and render view.Is it possible for director?I want to use react as view!

koistya commented 9 years ago

Yep, an example, how to do it, would be nice.

ibloat commented 9 years ago

async routing sounds pretty much like what you want.

var router = new director.http.Router().configure({ async: true });
  router.on('/:foo/:bar/:bazz', function (foo, bar, bazz, next) {
    // Go do something async, and determine that routing should stop
    next(false);
  });