【发布时间】:2011-11-07 19:54:57
【问题描述】:
我有这个 Backbone 模型:
graphModel
attributes
country
indicator
year
有对应的视图:
graphView
render()
this.model.get(...)
该应用程序还有一个加载 csv 数据的通用数据源:
dataSource
indicators
indicatorA
country
year
indicatorB
countries
years
每次更改模型属性时,我想在触发更改事件之前检查是否加载了该属性组合的数据。
我的问题是:将数据源与 Backbone 模型和视图解耦以便我可以轻松尝试注入的模拟数据的好方法是什么?
【问题讨论】:
标签: javascript model-view-controller backbone.js decoupling