在json请求中发送Html请求联系人页面

时间:2017-10-15 05:24:45

标签: javascript html angularjs json

HTML:

     <form id="myemailform" role="form"  name="myemailform" ng-submit="sendMail();">
    <input type="text" name="name" class="form-control" id="name" ng-model="name" placeholder="Your Name"ng-pattern="/^[a-zA-Z ]*$/" required ng-minlength ="1" />                      
    <input type="email" class="form-control"maxlength="40" name="email" id="email" ng-model="email"placeholder="Your Email" required />                      
    <input type="text" class="form-control sub" name="mobilenumber" ng-model="mobile"id="mobilenumber" placeholder="Mobile Number"ng-pattern="/^[0-9]*$/" required/>
    <input type="text" class="form-control sub" name="subject" ng-model="subject"id="subject" placeholder="Subject" />  
 <textarea class="form-control sub" name="message" rows="5" cols="10" data-rule="required" data-msg="Please write something for us" ng-model="message" placeholder="Message"  required ng-minlength ="1"></textarea>
 <input type="submit"  class="btn applyBtn" name="submit"/>
   </form>

JS:

$scope.sendMail = function(){
    $scope.newMessage = "<p>Name:"+$scope.name+"</p>"+"<p>MobileNo:" + $scope.mobile+"</p>"+"<p>Query:" + $scope.message+"</p>" ;
            console.log($scope.newMessage);
                var json = {
              "request": {
                  "name":$scope.name,
                 "from":$scope.email, 
                  "to": "sunitha_anilkumar@yahoo.com",
                  "subject": $scope.subject,
                  "message": $scope.newMessage
              }
            }

UserService.contactus(json).then(function (res) {
            if(res.json.response.statuscode == 0){
}
});
}

我需要将我的请求作为html格式发送到后端,以便用户收到使用格式化html提交的消息。但是当邮件到来时,我只是将内容作为

移动号码:782671

查询:我的查询

需要解决方案。

0 个答案:

没有答案