Try to add a name="giftform" attribute to the form. Also look for ng-submit directive for alternative approach.
On Monday, January 26, 2015 at 4:13:58 AM 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.
