JSFiddle - React, Tailwind, and code Playground
HTML
<script src="//code.jquery.com/jquery-2.1.1.min.js"></script>
<script src="//jashkenas.github.io/underscore/underscore-min.js"></script>
<script src="//jashkenas.github.io/backbone/backbone-min.js"></script>
<script src="https://rawgit.com/afeld/backbone-nested/master/backbone-nested.js"></script>
<div id="content"></div>
JavaScript
var model = new Backbone.NestedModel({
structure: {
abc: [
{ items: [1,2,3],
groupId: 123
},
{ items: [4,5,6],
groupId: 456
}
]
}
});
model.bind('change', function() {
$('#content').text("changes: " + JSON.stringify(model.changedAttributes()));
});
model.remove('structure.abc[1].items[2]');
// should print the new structure object