[SOLVED] CRUD operations in service provider only update the view after second time that accessed

Hello fellas!

I have a project in Ionic 2 that uses Sqlite for save the data.

I have created services providers to manage all the CRUD operations, but I got a problem: the data showed in the view component only updates the data change automatically after the second time that the view is loaded.

I recorded some videos for better analysis:

The code can be accessed here: https://bitbucket.org/snippets/marcusvbp/XpB66

Also, you can view the app (without all sqlite part) in this link: http://dev-grri.pantheonsite.io/doctorpet/

Please note that the showed data follows the CRUD operations as expected.

Thank you for your time.

no one can help me with this question?

Hi,

I figured where is the error. The App is working like expected.

Thank you all for the time.

where was it?
it think you should wrap your code in the ngZone.

I have three providers. the pet-provider.ts works like a charm, but the remedy-provider and recipe-provider has the behavior what I have described in the topic.

After a code analisys, I figured where is the problem: it is in this “else”: https://bitbucket.org/snippets/marcusvbp/XpB66#remedies-provider.ts-55

this “else” is in the remedy-provider and recipe-provider but not in pet-provider. after I removed this code, the service provider worked like the pet-provider.