Quantcast
Channel: Ionic Forum - Latest topics
Viewing all articles
Browse latest Browse all 70986

File plugin returns Directory List empty

$
0
0

@rashnk wrote:

in my ionic app I just want to list all the files/folders in sd card, im using the cordova-file-plugin

the code is below

.controller('MyCtrl', function($scope, $cordovaFile) {

  document.addEventListener('deviceready', function () {


  console.log('sdsd');

  var myPath = cordova.file.externalRootDirectory; // We can use the default externalRootDirectory or use a path : file://my/custom/folder

window.resolveLocalFileSystemURL(myPath, function (dirEntry) {
	console.log(dirEntry);
     var directoryReader = dirEntry.createReader();
     directoryReader.readEntries(onSuccessCallback,onFailCallback);
});

function onSuccessCallback(entries){
  console.log( 'The magic will happen here, check out entries with');
   console.log(entries);
}

function onFailCallback(){
  // In case of error
}


  });

});

http://ngcordova.com/docs/plugins/file/ in ngcordova file there is no function i found, so im using cordova javascript code in my ionic app,

The function returns empty array, i hae added the permission also, anyone had similar issue , pls help

Posts: 2

Participants: 1

Read full topic


Viewing all articles
Browse latest Browse all 70986

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>