I believe this does what you want, you'll need to change the form action to 
your paypal url:

http://jsfiddle.net/hhvx6L8s/2/


html

<div ng-app ng-controller="TestCtrl">
<form action="http://www.posttestserver.com/post.php"; name="giftform" 
method="POST" id="giftform" ng-submit="gimme()">
    <input type="text" name="item_name" value="$25 gift certificate" 
ng-model="model.item_name"/>
    <input type="text" name="amount" value="25.00" ng-model="model.amount"/>
    <button type="submit">Gimme!</button>
</form>


javascript

function TestCtrl($scope, $http) {
    $scope.model = {};
    $scope.model.selectedItem = {
        textValue: "$50 gift card",
        denomination: 50
    };
    $scope.model.item_name = "";
    $scope.model.amount = 0.00;
    
    
    $scope.gimme = function() {
        $scope.model.item_name = $scope.model.selectedItem.textValue;
        $scope.model.amount = $scope.model.selectedItem.denomination;       
 
    }
    
}






On Sunday, January 25, 2015 at 4:13:58 PM UTC-6, Jonathan Price wrote:
>
> So, I get why traditional form submission isn't really supported or 
> recommended.  But I have a situtation where I need to build a form and 
> submit it to paypal, and I'm really struggling to make it work.  I have 
> something like this now:
>
>     <form action="https://www.paypal.com/cgi-bin/webscr"; method="post" 
> id="giftform">
>         <input type="hidden" name="item_name" value="$25 gift certificate" 
> ng-model="model.item_name">
>         <input type="hidden" name="amount" value="25.00" 
> ng-model="model.amount">
>
>         <button class="btn btn-success" style="font-size: 20px;" 
> ng-click="gimme();">Gimme!</button>
>
> and a controller with this:
>
>
>     $scope.gimme = function() {
>         console.log(document.giftform);
>         document.giftform.item_name = $scope.model.selectedItem.textvalue;
>         document.giftform.amount = $scope.model.selectedItem.denomination;
>         // document.giftform.submit();
>     }
>
> And I'm getting : Error: document.giftform is undefined
>
>
> Surely this isn't so complicated, and I'm just missing something simple?
>
>

-- 
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 http://groups.google.com/group/angular.
For more options, visit https://groups.google.com/d/optout.

Reply via email to