I am striving to gather all the values from the UserHardware along with their respective parent keys. The child nodes housed within the randomly generated keys are structured as: name: Test, desc: test
https://i.sstatic.net/TypzB.png
Below is my code snippet in the constructor(Component)
this.userHardwareList = db.list('UserHardware/');
this.items = this.userHardwareList.snapshotChanges().map(changes => {
return changes.map(c => ({ key: c.payload.key, ...c.payload.val() }));
});
In the (template)
<li *ngFor="let item of items | async">
{{item.key}}
</li>
Currently, I am only able to retrieve the value udwcGxqx50ZtoF8EABoFh8GVet2
(UID). However, I also wish to access the values nested within this UID.
After attempting: {{item.name}}
I notice that nothing gets displayed.
Interestingly, when I modify the code in the constructor like so:
this.userHardwareList = db.list('UserHardware/udwcGxqx50ZtoF8EABoFh8GVet2');
Everything works flawlessly, allowing me to access values and unique generated keys using
{{item.name}}` {{item.key}}` {{item.desc}}`
The question now arises, how can I achieve the same functionality without specifying the UID?