On button click create dynamic form, autofill the data and post on url in Angularjs -


i using angularjs, trying implement payment gateway in web application , stuck @ step

so, @ first step have json data , request method , url on need post data.

json data sample : { "key1" : value1, "key" : value2 }

request method : post

url : mypaymentgatewayurl

my requirement is : when click on button make payment, should create dynamic form , auto fill data have in json , and post form data on url. process should happen under hood , should redirect payment gateway page.

js function

proceedtopayemnt: function(lead_id){        var payment = this;      var payment_provider = this.payment_provider;      var selected_payment_provider = this.selected_payment_provider;      var user_profile = userprofile.user_profile;        var answer = selected_payment_provider[payment_provider.psp_id];            if(answer == 1){          var lead_id = 145282;          payment.offlinepayment(lead_id);      }else{           var lead_id = 145282;          payment.onlinepayment(lead_id);      }                                                                                                                                                                                     },

the button code:

<button class="button" ng-click="proceedtopayemnt()">make payment</button>

please suggest solution above problem. in advance

you can use ng-repeat create controls json sample data, that. if dont want display form can use ng-hide hide form, , onclick of proceedtopayment button can fire submitbtn click. hope should solve this.

<form action="urlhere"  method="post">   <div ng-repeat="(key,value) in sampledata">     <input type="text" id="{{key}}"  ng-model="sampledata[key]" />     </div>   <button id="submitbtn" type="submit">submit</button> </form> 

Comments

Popular posts from this blog

c - How to retrieve a variable from the Apache configuration inside the module? -

c# - Constructor arguments cannot be passed for interface mocks -

python - malformed header from script index.py Bad header -