ngCordova - Write data to file

I'm trying to figure out how to write data to a file using ngCordova

The documentation states

$cordovaFile.writeFile(filePath).then(function(result) {
      // Success! 
  }, function(err) {
      // An error occured. Show a message to the user
  });

But I don't see where you then pass in the actual data you want to write. For example, how would I write some simple JSON to a file?

The documentation is changed now, it is :-

$cordovaFile.writeFile(filePath, data, options).then(function(result) {
  // Success! 
}, function(err) {
  // An error occured. Show a message to the user
});

But I was able to make it work on android only. iOS has some permission issues according to the official documentation :- https://github.com/apache/cordova-plugin-file/blob/master/doc/index.md#ios-quirks