0

I'm having the same issue as mentioned here: Can't access object property, even though it exists. Returns undefined

However in my case it's a property with data.hostId.id, where data comes in as full object and hostId is shown undefined when its actually present in the json object, here's how it looks:

enter image description here

enter image description here

As you can see, I'm trying to access the qgUSerHost(at the very end) from the object and it throws undefined. I tried setTimeout, not working…

I also tried the solution mentioned in that post but nothing helped. Any ideas on this one?

Cœur
  • 34,719
  • 24
  • 185
  • 251
user1234
  • 2,750
  • 3
  • 37
  • 83

2 Answers2

3

I think you should access that property like this.hostAsset["qgUserHost.id"] because of the . in the property name, so it wouldn't try to access the property id from some qgUserHost object.

Diego Cardoso
  • 975
  • 4
  • 14
1

'this.hostAsset.qgUserHost.id' != 'this.hostAsset.qgUserHost'

blrzzzt
  • 174
  • 5