Delete cached images from mobile app ionic angularjs
<p>I have an app and I want to delete the cached images downloaded by a particular user.Suppose <code>user1</code> download few images and logout out and then <code>user2</code> logged in and download few images. <code>User2</code> should not see cached images or downloaded images of <code>user1</code>.</p>

<p>Cached images showing all the images previously downloaded.</p>

<p>I want cached images to be downloaded after logged out.</p>

<pre><code>   if(ionic.Platform.isAndroid()){
                                        localPath = cordova.file.externalCacheDirectory;
                                    }else{
                                        localPath = cordova.file.cacheDirectory;
                                    }
                                    localPath = localPath + downloadFileName.trim().replace(/\s+/g, '-') + ext;

                                    var ft = new FileTransfer();
                                    ft.download(downloadLink, localPath, function(entry) {
                                        $ionicLoading.hide();
                                        console.log("Downloading report on path - " + entry.toURL());
                                        cordova.plugins.fileOpener2.open(entry.toURL(), downloadFileMimeType, {
                                            error : function(e) {
                                                console.log('Error status: ' + e.status + ' - Error message: ' + e.message);
                                            },
                                            success : function(fileEntry) {
                                                console.log('File opened successfully');
                                            }

                                        });
                                    }, function fail(error) {
                                        $ionicLoading.hide();
                                        console.log("Error while downloading report with error code - " + error.code);
                                    }, true, options);
                                }
</code></pre>