Hi all,

I'm trying to convert the following post to async, I dont know if anyone 
could possibly help me ?

angular.module('testAsync').controller('ContactController', function ($scope
, $http) {
    $scope.sendMail = function () {
        document.getElementById("info").innerHTML = "Sending, Please 
Wait...";
        document.getElementById("sendThatMail").style.visibility = "hidden";
        document.getElementById("sender").style.visibility = "visible";
        var data = $.param({
            emailAddress: $scope.emailAddress,
            emailMessage: "--- Name : " + $scope.myName + "--- Email 
Address : " + $scope.emailAddress + "--- Msg : " + $scope.myMsg,
            emailSubject: $scope.mySubject
            //emailName: $scope.myName
        });
        $http.post("api/SendMail", data, { headers: { 'Content-Type': 
'application/x-www-form-urlencoded' } }).success(function (data) {
            $scope.results = data;
            document.getElementById("info").innerHTML = data;
            document.getElementById("sender").style.visibility = "hidden";
            document.getElementById("sendThatMail").style.visibility = 
"visible";
        }).error(function () {
            alert("error");
            document.getElementById("sender").style.visibility = "hidden";
            document.getElementById("info").innerHTML = "Error Sending, 
Please try again...";
            document.getElementById("sendThatMail").style.visibility = 
"visible";
        });


    };
});

-- 
You received this message because you are subscribed to the Google Groups 
"AngularJS" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/angular.
For more options, visit https://groups.google.com/d/optout.

Reply via email to