EmailComposer Cordova no AngularJS

1

I was reading a project on gitHub from cordova email plugin and I did not understand how it installs. It gives you the option to download the files, and then asks you to put that line in the xml.

<gap:plugin name="cordova-plugin-email-composer" />

Only then what do I have to do? to put composer.js inside the js files folder? and the folders of the android devices, ios and w8, where are they going? Can anyone help me?
The source comes from here: link

    
asked by anonymous 13.04.2016 / 18:47

1 answer

0

First you have to install it, the way plugins are installed by default in Cordova:

cordova plugin add https://github.com/katzer/cordova-plugin-email-composer.git

Next you check in your code if the corrog is enabled (so you do not give an error when you are viewing in the pc browser).

And then you use the isAvaible and open methods of the plugin in question

It would look something like this:

document.addEventListener('deviceready', function () {
  if(window.cordova){
    sendMail('teste', "[email protected]", "E aí fulano maluco, continua insano?");
  }
}, false);
function sendMail(assunto, paraQuem, corpoDoEmail){
    cordova.plugins.email.isAvailable(
    function (isAvailable) {
        if(!isAvailable){
            return window.alert("Nao pode enviar email");
        }
        cordova.plugins.email.open({
            to:      paraQuem,
            subject: assunto,
            body:    corpoDoEmail
        });
    }
    );
}

This part of <gap:plugin name="cordova-plugin-email-composer" /> is automatically inserted with the cordova plugin add command I mentioned above. If you want to open a blank draft with no data filled in, simply call open without passing any parameters:

cordova.plugins.email.open();
    
13.04.2016 / 19:02