Skip to content
Advertisement

HOW TO DISPLAY DATA IN IONIC 4

good afternoon developers, i have fetch data from my api and the data is responded as below

JavaScript

and my code is below

JavaScript

when i type {{wallet[“amount”}} it returns Cannot read property ‘amount’ of undefined

Advertisement

Answer

You probably need to use the optional chaining operator with dot notation like this:

JavaScript

This will not throw an error when the value is undefined, because it IS undefined until your API request is completed. By the way, this has nothing to do with Ionic, it’s more of an Angular thing.

User contributions licensed under: CC BY-SA
4 People found this is helpful
Advertisement