cordova plugin add "Plugin Name"
Like Cordova plugin add cordova-plugin-battery-status
This battery-status Plugin will be added to your ionic project.
You can see the Plugin details Here
then add some code to test this plugin in the ionic app.js file
in that file find ready function and add some code like mentioned below in that function.
alert(device.model);
window.addEventListener("batterystatus", onBatteryStatus,
false);
function onBatteryStatus(info) {
// Handle the online event
alert("Level: " + info.level + " isPlugged: " +
info.isPlugged);
}
Now This will work on the device but it will not work in the browser.