Using File Transfer with InAppBrowser

I made an Ionic app that immediately opens a external url with the InAppBrowser plugin. This is how my .js Controller looks like this:

angular.module('starter', ['ionic'])
   .run(function($ionicPlatform) {
    $ionicPlatform.ready(function() {

    var url = "";
    var windowref =, '_blank', 'location=no,closebuttoncaption=Return,toolbar=yes,enableViewportScale=yes');


My problem now is I want to download a file whenever the user encounters a download link. I installed the File Transfer plugin but I don’t know how to integrate it with my controller.

I looked around for answers but they are all snippets of code and I don’t really know how to implement it on my scenario.

I’m pretty new to Ionic/Cordova and I would appreciate a help.