You can easily control many Cordova plugins through Ionic Native , which is automatically installed using Ionic 2.
For example, if you want the Cordova Plugin Native Storage plugin, you will find this plugin in the Ionic Native docs, here , and, as you can see, there are all the steps you need to take to get the plugin to work.
In our case, you need to install the plugin through the console:
ionic plugin add cordova-plugin-nativestorage
Then import and use this plugin from Ionic Native in our application:
import {NativeStorage} from 'ionic-native';
NativeStorage.setItem('myitem', {property: 'value', anotherProperty: 'anotherValue'})
.then(
() => console.log('Stored item!'),
error => console.error('Error storing item', error)
);
Enjoy.
source
share