How to Install 3rd Party Libraries in Ionic 2

How to Install 3rd Party Libraries in Ionic 2

Follow Josh Morony on

Ionic 2 allows you to do a wide range of things right out of the box, but there is likely going to come a time where you need to install some 3rd party library to add additional functionality into your applications.

You may want to add Google Maps, add a charting library, add support for PouchDB, or any of the thousands of libraries that are available out in the wild.

There are some specific steps you will need to take in order to get most of these libraries working in Ionic 2, in this video tutorial, I walk through a couple of common examples.

Here’s the video:

  • You can install most libraries using npm install LIBRARY_NAME
  • You can install types for most libraries using npm install @types/LIBRARY_NAME
  • Once a library has been installed, you can usually import it into components that require it like this: import Thing from 'libraryname'
  • It is also possible to add a library to your application just be adding a <script> tag to your index.html file

IMPORTANT: Although most libraries you encounter will be able to be installed like this, or in a similar way to this, it will depend on the library itself.

Check out my latest videos: