How to use Cordova plugins in an Ionic project?


#1

I have a project that requires the Camera and FileTransfer Cordova plugins. I managed to install these into the project but the API isn’t available to my JS code so I’m getting e.g. error:

ReferenceError: Camera is not defined
at Scope.$scope.takePic

How do I make the API available in an Ionic project?


#2

For help on integrating cordova plugins with angular, check out some of these angular wrappers.


#3

Thanks for the link! But does that mean I have to write wrappers for every single Cordova plugin I want to use (the ones in the git repo seem all related to device-specific API). What about FileTransfer?


#4

I would, just to be safe and keep things in synch on the angular side. For the file transferplugin, take a look at this SO post. Also, this post here on the forums.