$cordovaFile keeps giving error code 5

The problem is I get error from $cordovaFile with error code 5. I get the same error with all possible methods of $cordovaFile. I am using Ionic framework, cordova-file plugin is 2.1.0 version. I got the same error on both platforms: iOS and Android.

Searched everywhere for the solution to my problem, but I believe that I am missing one small, but very important part.

My code part:

$ionicPlatform.ready(function() {
    $cordovaFile.checkDir(cordova.file.dataDirectory, 'slides').then(function(success) {
        alert('dir exist');
    }, function(error) {
        $cordovaFile.createDir(cordova.file.dataDirectory, 'slides', false).then(function(success) {
            alert('dir created');
        }, function(error){
            alert(JSON.stringify(error));
        });
    });
});

SOLVED:

I've checked ngCordova js file and saw that these functions does not even relate to ones used on cordova-file plugin so I've tried updating ngCordova js files with bower and it helped.