我刚开始接触 Dojo,我对所有模块的数量和质量印象深刻。然而,来自 AngularJS,我发现Dojo 的 MVC的双向数据绑定有点缺乏。
真的没有办法订阅 Dojo 对象存储,在模板中有一个循环来迭代存储中的项目,并在添加/删除项目时自动更新视图?示例教程用于dojo/store/Observable实现这个繁琐的逻辑:
results.observe(function(item, removedIndex, insertedIndex){
    // this will be called any time a item is added, removed, and updated
    if(removedIndex > -1){
        removeRow(removedIndex);
    }
    if(insertedIndex > -1){
        insertRow(item, insertedIndex);
    }
}, true);
function insertRow(item, i){ ... }
function removeRow(i){ ... }
在 AngularJS 中,你会做这样的事情:
<li ng-repeat="item in results">
  <span>{{item.text}}</span>
</li>
那么我是否必须在 Dojo 广泛的小部件和模块集合和 AngularJS 的具有双向数据绑定的直接模板之间做出选择?