javascript - Angular Ben Drucker's credit card script not working -
i trying integrate ben drucker's credit card validation (https://github.com/bendrucker/angular-credit-cards) in our angular application.
in app.js have following declaration:
angular .module('flyvipapp', [ 'nganimate', 'ngcookies', 'ngresource', 'ngroute', 'ngsanitize', 'ngtouch', 'mm.foundation', 'ui.router', 'credit-cards', 'ui.router.statehelper' ])
the following form code:
<div id="sidepanelcontent"> <a ui-sref="^" ui-sref-opts="{reload: true}" class="closesidepanel"><img src="images/admin/botao-fechar.png" alt="fechar"></a> <h1>pagamento voo</h1> <form name="ccform"> <div> <p ng-show="flight"> <strong>id:</strong> {{flight.flightid}} </p> <p ng-show="flight"> <strong>voo:</strong> {{flight.fromairport.name}} ➝ {{flight.toairport.name}} </p> <p ng-show="flight"> <strong>horário:</strong> {{flight.dateofdeparture | formatdatetime}}h </p> <p ng-show="flight"> <strong>lugares disponíveis:</strong> {{flight.availableseats}} </p> <p ng-show="flight"> <strong>aeronave:</strong> {{flight.airplane.name}} </p> <p ng-show="flight"> <strong>preço atual:</strong> r$ {{flight.price | formatprice}} </p> </div> <h1>dados cartao</h1> <div class="large-12 columns no-paddingleft"> <label> nome no cartao:</label> <input type="text" ng-model="cardname" /><br /> </div> <div> <label> tipo de cartao:</label> <select ng-model="cardtype" ng-options="type type type in ['visa', 'american express', 'mastercard']"></select><br /> </div> <div class="large-12 columns no-paddingleft"> <label>numero cartao:</label> <input type="text" ng-model="card.number" cc-number cc-type="cardtype" /><br /> </div> <label>codigo de seguranca:</label> <input type="text" ng-model="card.cvc" cc-type="cardnumber.$type" /><br /> <label>data expiracao:</label> <div cc-exp> <div class="col-xs-3"> <label>mes:</label> <input type="text" ng-model="card.exp_month" cc-exp-month /> </div> <div class="col-xs-3"> <label>ano:</label><input type="text" ng-model="card.exp_year" cc-exp-year /><br /> </div> </div> <script> console.log(card.number + " " + card.exp_month); </script> <button class="button" ng-click="dopayment(flight.flightid)" ng-disabled="!ccform.ccnumber.$valid">pagar com cartao de credito</button> </form> </div>
the form gets error "error: can't find variable: "card".
i thought once included "credit cards" module in app.js card automatically declared.
thanks
Comments
Post a Comment