I have a service which holds some data:
@Injectable()
export class DataService {
data = {
a: [
{label: 'label 1', checked: true},
{label: 'label 2', checked: true},
{label: 'label 3', checked: true}
]
}
}
and a component that imports the service and uses data from data.a to generate checkboxes (with checked property indicating the initial state of each checkbox). After user checks and unchecks boxes, values in DataService are automatically updated by angular.
There is another service StorageService which also injects DataService and is supposed to store data.a to browser's local storage automatically every time a checked property is changed. What I can't figure out is how to observe those changes for individual object properties which are nested deeply like so?