Reputation: 35
I'm using cordova plugin to open an external url and download pdf, this will assign an object in code and this is shown in ui as an icon for file.
This is working fine in regular flow. if i go to next state (using $state.go) and come back to previous screen and try to do the same (downloading pdf file), the UI is not getting updated but the object is assigned.
I've used the $scope.$apply(); for updating the DOM. But not working
Divided the function to implement using promises. but not working
window.resolveLocalFileSystemURL(destDir, function (drootDir) {
console.log('Access to the dest directory granted succesfully');
drootDir.getDirectory(destFolder, {
create: true
}, function (ddir) {
file.moveTo(ddir, destFileName, function () {
$scope.mainobject.pdfFile = {
'rootPath': destDir,
'folderPath': destFolder,
'fileName': destFileName
};
$scope.$apply();
});
});
});
Upvotes: 1
Views: 52
Reputation: 4248
Try updating the angular element by using $timeout
function.
Include assigning the object inside the $timeout
function.
Upvotes: 1