I have an Angular scope that looks something like this:
{
node_type: 100, node_instance: 001, value: 'pony', show: true, childNodes: {
node_type: 100, node_instance: 011, value: 'cat', show: false, childNodes: {
node_type: 101: node_instance: 001, value: 'apple'show: true,
}
node_type: 100: node_instance: 012, value: 'kitty', show: true,
node_type: 100: node_instance: 013, value: 'meow', show: true,
}
node_type: 100, node_instance: 002, value: 'horse', show: true, childNodes: {
node_type: 102: node_instance: 001, value: 'dog', show: false,
node_type: 100: node_instance: 014, value: 'mutt', show: true,
}
}
It's obviously much (much) deeper and more complex than this.
Upon making various actions (say, changing "mutt" to "Fido"), my server will return newly updated, seemingly unrelated data in a set like…
{ node_type:101, node_instance:001, show:false }
I've found various ways of traversing the scope to find the 101,001 node, but they all involve sending copies of scope nodes to a traversal function, updating properties in a copy is worthless. How can I tell the function to update the scope at the correct address, or update node properties by reference?
(Or is the solution as dumb as setting a data="show" property in the DOM, updating the DOM outside of Angular, and then setting a scope.apply() request? I've had bad luck with scope.apply()…)