我正在尝试发送一封电子邮件,默认情况下会将JSON数据拉入,我收到的问题是我的邮件一旦收到,我只看到对象而不是值。有什么想法吗?
链接到我的网站:http://wingfield.vmgdemo.co.za/
我收到的邮件中收到了什么:
Make: {{car.make}}
Variant: {{car.variant}}
Year: {{car.year}}
Price: {{car.selling_price}}
我的意见:
<input type="text" ng-model="vm.drive.make" class="form-control" name="make" id="make" ng-init="vm.drive.make='{{car.make}}'" value="{{car.make}}">
我的邮件控制器:
(function() {
'use strict';
var controllerId = 'testDrive';
var app = angular.module('app').controller(controllerId, testDrive);
function testDrive($scope) {
var vm = this;
vm.drive = {
name: '',
number: '',
email: '',
message: '',
make: '',
variant: '',
year: '',
selling_price: ''
};
vm.sendMail = function sendEmail() {
var driveRequest = '';
var data = {
notification: {
ToList: '',
CcList: '',
BccList: '',
Subject: 'Contact from ' + vm.drive.name,
Message: vm.drive.message + '\nContact Number: ' + vm.drive.number + '\n\nInterested In:' + '\nID: ' + vm.drive.carid + '\nMake: ' + vm.drive.make + '\nVariant: ' + vm.drive.variant + '\nYear: ' + vm.drive.year + '\nPrice: ' + vm.drive.selling_price,
MessageSubject: 'Enquiry from ' + vm.drive.name,
ToName: 'Wingfield Motors',
FromName: vm.drive.name,
FromEmail: vm.drive.email
}
};
driveRequest = JSON.stringify(data);
$.ajax({
"url": "--REMOVED--",
"method": "POST",
"headers": {
"content-type": "application/json",
"accept": "application/json"
},
data: driveRequest,
dataType: "json",
success: function(response) {
//
},
error: function(response) {
//
}
});
};
}
})();