I am using a cordova email plugin in that works when I send simple text.
However, I am trying to instead use a template to construct the body of the email. I thought $compile would do the trick so I created an on click function:
$scope.openShare = function (title,body) {
var templateURL = "templates/roi-email.html";
$http.get(templateURL).success(function(data, status, headers, config) {
var templateRendered = $compile( data )( $scope );
if(window.plugins && window.plugins.emailComposer) {
window.plugins.emailComposer.showEmailComposerWithCallback(function(result) {
console.log("Response -> " + result);
},
title, // Subject
templateRendered, // Body
[], // To
null, // CC
null, // BCC
true, // isHTML
null, // Attachments
null); // Attachment Data
}
However, templateRendered is not a string object. I think it is an mg-view object.
So how do covert the raw html in 'data' to a rendered string to i.e., templateRendered to pass to the email composer?