How to use in ionic 2

I want to use in ionic2 , is there any way to use package in ionic2?

I can confirm that it works correctly. The two ways to do it would be:

  1. npm install it and then add it to the typings.json correctly so it can be imported like you would anything else. This can be hard to get right so I would use option 2
  2. Add the script src tag for it in index.html this guy: <script src="/"></script>, then if its a typescript project add this at the TOP (first line) of whatever file you want to use in use: declare var io:any This basically tells the Typescript compiler to calm down and just trust us that the variable is defined globally, which it is once the tag in index.html is loaded. Its not required, but if you don’t have it the compiler will complain but it will still work. This method works for any javascript packages that don’t have Typescript definitions. You won’t need to import anything, and can do everything you would as if you imported the io variable.
1 Like