Working With Shared Providers In An Ionic 2 Mobile App

By  Nic Raboy

When developing an Ionic 2 application there are often scenarios where it probably isn’t a good idea to include repetitive source code in multiple application pages.  A common example of this would be when it comes to database interaction in an Ionic 2 application.  Sure you could establish a connection to the database on every page and query it, but it would probably make more sense to use it like a shared provider.

We’re going to see how to create a SQLite shared provider, often referred to as a shared service or sometimes a singleton class, in an Ionic 2 Android and iOS application using Angular 2.

To make what we’re about to cover as easy to understand as possible, we’re going to start with a fresh Ionic 2 project.  From your Terminal (Mac and Linux) or Command Prompt (Windows), execute the following:

Read full articles...

Share on Google Plus

About www.

This is a short description in the author block about the author. You edit it by entering text in the "Biographical Info" field in the user admin panel.
    Blogger Comment
    Facebook Comment


Post a Comment