Ionic sqlite db acess globally


#1

how to acess sqlite db gloabally in ionic 2 using providers


#2

Create a separate provider of your sqlite and you need to initialize public variable like:
public db: any;
in that provider.

After that import same provider and define it in providers list in your app.module.
After that on your screens simply import that provider, don’t define it in provider list. You will always get reference of same db variable (marked above)


#3

Thanks @vaibhav915
can you please share some sample code so it will be very useful,thanks in advance