How to show the result (data) of Query FUNCTION in html (How to use Json?)


I want to display the data on the screen in this way:

Calling the function on HomePage (home.ts):

calling the data that I need in on database (service.ts):

Well, I think that is must be simple, mas I’m a beginner at ionic2, and I don’t know how to display the result of query on HTML =/
Someone can help me, please?



you need interpolation, using {{ }}

Check for examples

Basic angular stuff…




But its doesn’t work, its a function that I called and not a property of class or event.

if I put interpolation, causes the following error. I don’t know if exist other form to calling a function to bring my data on html



totalCartoes returns a Promise that you are ignoring. Instead, assign it to a controller property in a then block, and then you can use the interpolation mentioned above.

this.cartaoService.totalCartoes().then(tc => this.totalCartoes = tc);


I didn’t understood. =/

I wanna tried to convert of result to json


But still doesn’t work

And I don’t know why how to convert too


I resolved with json.