Below, you can see the output from these two logs. One is of the object itself, the other is of one of it's properties. Seems like a weird behaviour, where the property is set and visible in the first log, but undefiened when accessing it directly.
- The string returned via Get request from a text file (blob).
Important Note: The strings are a bit large (300kb)
This is what the assignment of the string looks like:
await this.http.get(assetPath, {responseType: 'text'}).subscribe((content) => {
/// Conent is the string representing the text in the file
dynamicAsset.original = content;
this.findAndChangeAsset(dynamicAsset);
}
- Trying to console.log the object returns the object with the property 'original' set properly:
- Trying to access the property itself and log it, shows it's undefined
The console logs whithin findAndChangeAsset. As you can see, they are one line after the other. I can even change the order and it won't work. Crazy!
Things I tried with no success:
- JSON.stringify(obj) / JSON.parse(obj)
- Accessing foundAsset['original']
- Concat empty strings