When working with Angular, if you have code in the view that looks like this:
<span ng-model="foo.bar1"></span>
<span ng-model="foo.bar2"></span>
<span ng-model="foo.bar3"></span>
Due to how Angular maps objects, you cannot simply do this in the controller:
$scope.foo.bar2 = "something";
Instead, you must reassign the entire object like so:
$scope.foo = {
bar1: "value1",
bar2: "something",
bar3: "value2"
}
Therefore, whenever you need to change just one property of the object, you will need to reassign all other values as well.