Ionic 2 import Cordova Plugin


#1

Hi All,

I am trying to use this simple-crypto Cordova Plugin.

I install:

cordova plugin add https://github.com/VJAI/simple-crypto

Then in the code:

(1) If I try:

    this.encrypter = cordova.plugins.SimpleCrypto;

I get:

ERROR in ./app/pages/service/personService.ts
(304,42): error TS2339: Property 'SimpleCrypto' does not exist on type 'CordovaPlugins'.

(2) If I try:

    this.encrypter = window.plugins.SimpleCrypto;

I get:

ERROR in ./app/pages/service/personService.ts
(305,33): error TS2339: Property 'plugins' does not exist on type 'Window'.

(3) If I try:

    this.encrypter = require("com.disusered.simplecrypto.SimpleCrypto");

I get:

ERROR in ./app/pages/service/personService.ts
(305,26): error TS2304: Cannot find name 'require'.
ERROR in ./app/pages/service/personService.ts
Module not found: Error: Cannot resolve module 'com.disusered.simplecrypto.SimpleCrypto' in E:\Development\IDE\ionic-apps\theWhoZoo\app\pages\service
 @ ./app/pages/service/personService.ts 266:25-75

If anyone can advise how I can import this plugin, I would appreciate it.