Ionic2 Cordova Plugins not working

Hi All,

I am creating a new Ionic2 app.

image


My issue is I am trying to make use of the cordova-plugin-camera plugin, but can’t access the Camera object. If anyone knows what I am doing wrong, I would appreciate some help.


Error from CLI after:

ionic run android --livereload --lc

I have some Cordova plugins installed, e.g.

cordova plugin add cordova-plugin-camera --save --global

I have also installed typings:

npm install -g typings

When I try the following, I get another error:

typings install cordova --save --global

My sourcecode:

SOLVED: added the following, now it works.

declare var navigator: any;

Instead using the raw cordova plugin, you should use ionic-native

Not only does it provide the proper type information and autocompletion, but it handles any errors that cordova and angular2 can create. Most of which come from cordova’s callbacks and angular using promises and observables.

Thank you mhartington, will do