Type mismatch error

I am using this code to locate the folder using ngcordava.

  $cordovaFile.copyDir(cordova.file.applicationDirectory, "www/applicationPackage/default/database", destinationPath)
            .then(function (newfile) {

and I am getting an error of “TYPE_MISMATCH_ERR” and error code 11.

Please help
Thanks in advance

1 Like

first of all you can’t write into the www folder of you application (cordova.file.applicationDirectory is only read) and
second: the syntax is copyDir(path, folder, newpath, newfolder) so i suggest to use

var databasePath = cordova.file.applicationDirectory+'www/applicationPackage/default';

$cordovaFile.copyDir(databasePath, "database", destinationPath)
            .then(function (newfile) {

and the solution for moving files from the asset folder https://issues.apache.org/jira/browse/CB-7273
is a simple $.get or $fileTransfer.

hope it helps