Javascript 条纹检出在angular 1.x中不起作用
我使用条带付款来处理付款。我跟踪了这个项目和这个 我的项目有嵌套视图,也使用路由器 我的项目结构看起来像Javascript 条纹检出在angular 1.x中不起作用,javascript,angularjs,stripe-payments,angular-routing,Javascript,Angularjs,Stripe Payments,Angular Routing,我使用条带付款来处理付款。我跟踪了这个项目和这个 我的项目有嵌套视图,也使用路由器 我的项目结构看起来像 src app views controllers directives index.html app.js app.js是手动加载angular模块并具有路由器的地方 app.js index.html是包含angular和stripe脚本的地方 index.html formData.tpl.html有另一个ui路由器 formData.tp
src
app
views
controllers
directives
index.html
app.js
app.js是手动加载angular模块并具有路由器的地方
app.js
index.html是包含angular和stripe脚本的地方
index.html
formData.tpl.html有另一个ui路由器
formData.tpl.html
提交
我得到了验证工作,但没有打印在控制台时,我点击提交。我猜js没有被解雇。如果你需要更多信息,请告诉我 这将呈现为嵌套表单,这是无效的html。大多数浏览器将内部表单视为非表单元素,从而默默地“原谅”了这一点。
如果您将签出表单从注册表单中移出,这将使您走上正确的轨道。是的,如果我在注册表单之外有此表单,它将起作用。但我真的需要这个在里面
var myApp = angular.module('myApp', ['ui.router', 'formData']);
myApp.config(function($stateProvider, $urlRouterProvider, $httpProvider) {
// routers
}
<head lang="en">
<script type="text/javascript" src="https://js.stripe.com/v2/"></script>
<Script src="resources/angular.min.js"></Script>
<Script src="resources/angular-ui-router.min.js"></Script>
<script src="app.js"></script>
<script src="directives/formData/formData.js"></script>
<script type="text/javascript"
src="resources/angular-payments.js">
</script>
<script>
Stripe.setPublishableKey('key')
</script>
</head>
<div>
<div ui-view>
</div>
</div>
var formData = angular.module('formData',['angularPayments']);
formData.directive('formData',function(){
return {
restrict: 'EA',
scope: {},
replace: true,
link: function($scope, element, attributes){
},
controller: function($scope,$attrs,$http, $state){
//This is the callback for strip from the links above as followed
$scope.stripeCallback = function (code, result) {
console.log("inside cc callbakc");
if (result.error) {
console.log("credit card error");
window.alert('it failed! error: ' + result.error.message);
} else {
console.log(result);
console.log("credit card succes "+result.id);
window.alert('success! token: ' + result.id);
}
};
},
templateUrl: 'directives/formData/formData.tpl.html'
}
});
<form id="signup-form" ng-submit="processForm()">
<!-- our nested state views will be injected here -->
<div ui-view></div
</form>
<form stripe-form="stripeCallback" name="checkoutForm">>
<input ng-model="number" placeholder="Card Number"
payments-format="card" payments-validate="card" name="card" />
<input ng-model="expiry" placeholder="Expiration"
payments-format="expiry" payments-validate="expiry"
name="expiry" />
<input ng-model="cvc" placeholder="CVC" payments-format="cvc" payments-validate="cvc" name="cvc" />
<button type="submit">Submit</button>
</form>