angularjscordovaionic-frameworkace-plugin

How to use ace plugin in ionic application?


I have added the ace plugin ionic (ionic plugin add cordova-plugin-ace). But i tried to access the

if (ace.platform == "Android")

but its gives me following error:

error:ReferenceError: ace is not defined

when i tried to use:

  if (window.ace.platform == "Android")

I am getting this error:

platform is not defined to undefined ace.

please help me how to use ACE plugin in my application?


Solution

  • In vanilla cordova app, we use to invoke the plugin code inside deviceready event listener and in ionic framework platform ready is the equivalent of Cordova deviceready event.

    Invoke plugin code inside platform ready which ensures that the cordova and plugins are loaded completely.