【发布时间】:2016-05-10 23:48:39
【问题描述】:
我正在使用 Cordova + Ionic framework(使用 AngularJS)+emailComposer plugin 创建一个表单样式的移动应用程序。
这个想法是用户填写一些下拉菜单、单选框等;然后点击一个按钮,该按钮使用 emailComposer 将响应数据加载在一些预定义的 HTML 中,以在手机的本机电子邮件应用程序中的某个位置发送电子邮件,用户需要使用该应用程序。
我有一个变量 $scope.foo 将一些 HTML 加载到电子邮件正文中,问题是我需要将其他响应数据(变量)嵌套到该变量中。 (我不能让 emailComposer 接受这个变量)。
问题是如何在另一个 $scope 变量中的某个 HTML 中显示 $scope 变量?
由于 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
);
}
}
});
【问题讨论】:
标签: javascript html angularjs cordova ionic-framework