Backbone Routers: wait for data to be fetched first

前端 未结 2 1465
醉话见心
醉话见心 2021-02-08 05:37

I think I don’t quite get the idea behind the proper usage of Backbone routers. Here’s what I’ve got:

I have some data that I fetch from the server when the page loads a

2条回答
  •  半阙折子戏
    2021-02-08 06:08

    I'm just checking in my .render() method that all required fields are filled, before using it. If it's not filled yet - i'm rendering an 'Loading...' widget.

    And all my views are subscribed to model changes, by this.model.bind('change', this.render, this);, so just after model will be loaded, render() will be called again.

提交回复
热议问题