Encryption file angularjs


#1

hello there… how to encryp file with angularjs or cordova plugin?

i found something https://github.com/disusered/cordova-safe and i got error cordova is not defined. maybe another way to encrypt file with angularjs

thx :slightly_smiling:


#2

anyone can help this problem?


#3

Try in an emulator or on a physical device.


#4

how about a error? ReferenceError: cordova is not defined

this my index.html

this my app.js

and this my controller. im create a some function.

how to fix it?
thx A_Burgess :slightly_smiling: I’m very appreciative for the reply :slightly_smiling:


#5

Maybe you can use a full js solution like cryptojs.


#6

At the top of file try inserting the code:

declare var cordova;


#7

you must to wait the event “deviceready” before cordova variable be defined
add event listener and push your code there

 document.addEventListener("deviceready", onDeviceReady, false);
     function onDeviceReady() {
           //.....then you can use cordova here 
     }