Save to file.txt IONIC Cordova File Plugin problem with size file


$scope.test2 = function(param){
var data = param
fileDir = cordova.file.externalDataDirectory.replace(cordova.file.externalRootDirectory, ‘’);
var filePath = fileDir+“allNews.txt”;
$cordovaFile.writeFile(filePath, data, true).then(function(result) {
}, function(err) {


I just wanna save string text to file.txt on my device. this code works, but after save is problem. In this file is not all string, which i have in var data. in file are first 7 chars. Please help me