I have my object
$scope.obj = {
id : 0,
name : 'parent',
childs : [{
obj_id : $scope.obj.id,
name : 'child1',
}, {
obj_id : $scope.obj.id,
name : 'child2',
}]
}
if I change the ID attribute of my $scope.obj dynamically with an input it won't update the obj_id value of my child's objects.
<input type="text" ng-model="obj.id" />
But if I add a new object within the childs attribute like this after having updated the $scope.obj.id value
$scope.obj.childs.push({
obj_id : $scope.obj.id,
name : 'child3',
});
the obj_id attribute of my recently child object push will have the new value of $scope.obj.id set in with the input.
Thank you in advance.