Using custom plugins

Hi,

I am trying to learn how to use custom plugins.

I have installed a plugin using “cordova plugin add cordova-plugin-audioinput”
It has been added to config.xml file of my ionic app.

When button is pressed in my app, from associated click function, I want to call one of the API’s of plugin. How do I get access to the plugin in my .ts file. I have tried various ways of accessing plugins but can’t seem to get hold of plugin handle.

My function is like:

TestFunction()
{

if ( (window.plugin) )
  alert (window.plugin);
else if ( (window.plugins) )
  alert (window.plugins);
else if ( (window['plugins']) )
  alert (window['plugins']);
else
  alert ('failed to get cordova plugins');

}

I get “failed to get cordova plugins” message.

I have added cordova.js in .html file.

If some one knows correct ways to accessing plugins, please advice.

regards,
Sameer