I'm creating a form style mobile application using Cordova + Ionic framework (which uses AngularJS) + emailComposer plugin.
我正在使用Cordova + Ionic框架(使用AngularJS)+ emailComposer插件创建一个表单样式的移动应用程序。
The idea is the user fills in a few dropdowns, radio boxes etc; then hits a button which uses emailComposer to load the response data wrapped in a bit of predefined HTML to email somewhere in the phone's native email application, which the user will need to have working.
这个想法是用户填写一些下拉菜单,收音机等;然后点击一个按钮,该按钮使用emailComposer将包含在一些预定义HTML中的响应数据加载到手机本机电子邮件应用程序中的某个地方,用户需要工作。
I've got a variable $scope.foo loading some HTML into the body of the email, the problem is I then need to nest the other response data (variables) into that variable. (I can't get emailComposer to accept anymore than this one variable).
我有一个变量$ scope.foo将一些HTML加载到电子邮件的正文中,问题是我需要将其他响应数据(变量)嵌套到该变量中。 (我不能让emailComposer接受比这一个变量更多的东西)。
The question is how do I display the $scope variables inside some HTML inside another $scope variable?
问题是如何在另一个$ scope变量中的某些HTML中显示$ scope变量?
As emailComposer isn't using the AngularJS I can't continue using the {{piping}} I think.
由于emailComposer没有使用AngularJS,我无法继续使用{{piping}}。
var exampleApp = angular.module('starter', ['ionic', 'ngStorage'])
exampleApp.controller("EmailController", function($scope) {
$scope.someVariable = "whatever";
$scope.anotherVariable = "something";
$scope.foo = "<h1>I want to insert the two variables here: {{$scope.someVariable}} and here: {{$scope.anotherVariable}} in some nice HTML</h1>";
$scope.sendEmail = function() {
if(window.plugins && window.plugins.emailComposer) {
window.plugins.emailComposer.showEmailComposerWithCallback(function(result) {
console.log("Email Sucess");
},
"subject here", //subject line
$scope.foo, //body
["someone@example.com", "some.else@example.com"], //to
null, //CC
null, //BCC
true, //isHTML
null, //attachments
null //attachment data
);
}
}
});
1 个解决方案
#1
0
You may be able to use something like var emailBody=$scope.$eval($scope.foo) and then pass the emailBody variable to your sendEmail function. That might not be 100% correct, but basically, evaluating the body and then passing the result seems like the correct approach.
您可以使用var emailBody = $ scope。$ eval($ scope.foo)之类的东西,然后将emailBody变量传递给sendEmail函数。这可能不是100%正确,但基本上,评估正文然后传递结果似乎是正确的方法。
#1
0
You may be able to use something like var emailBody=$scope.$eval($scope.foo) and then pass the emailBody variable to your sendEmail function. That might not be 100% correct, but basically, evaluating the body and then passing the result seems like the correct approach.
您可以使用var emailBody = $ scope。$ eval($ scope.foo)之类的东西,然后将emailBody变量传递给sendEmail函数。这可能不是100%正确,但基本上,评估正文然后传递结果似乎是正确的方法。