Javascript 不与角度变量绑定的表单输入
我试图通过Angular自动发送表单,并将输入值与控制器中的变量绑定。然而,由于某些原因,这些价值未被确认Javascript 不与角度变量绑定的表单输入,javascript,html,angularjs,ionic-framework,Javascript,Html,Angularjs,Ionic Framework,我试图通过Angular自动发送表单,并将输入值与控制器中的变量绑定。然而,由于某些原因,这些价值未被确认 <ion-view cache-view="false" ng-controller="CashierController as cashCtrl" class="background"> <ion-nav-title></ion-nav-title> <ion-content padding="true"> <fo
<ion-view cache-view="false" ng-controller="CashierController as cashCtrl" class="background">
<ion-nav-title></ion-nav-title>
<ion-content padding="true">
<form id="cashier" name="cashCtrl.cashierForm" method="POST" action="https://url.action" target="screen">
<input type='hidden' id='token' name='token' ng-model="cashCtrl.token" />
<input type='hidden' id='merchantId' name='merchantId' ng-model="cashCtrl.merchantId" />
<input type='hidden' id='customerId' name='customerId' ng-model="cashCtrl.customerId" />
<input type='hidden' id='action' name='action' ng-model="cashCtrl.action" />
<input type='hidden' id='paysolName' name='paysolName' ng-model="cashCtrl.paysolName" />
</form>
<iframe name="screen" height=600 width=320>
</iframe>
</ion-content>
</ion-view>
值得注意的是,如果我使用花括号表示法指定变量,如:{{{cashCtrl.token}
,但不在表单上,则会显示绑定的值。此外,行console.log(this.cashierForm)代码>返回未定义的
我做错了什么?ng model
没有为隐藏的
输入字段设置值。在这种情况下,我如何绑定到隐藏字段?我想这个链接回答了一个问题,您可以执行类似var self=this的操作代码>执行此操作后,为什么要再次使用此
?与问题无关,但只是一个建议ng model
没有为隐藏的
输入字段设置值。在这种情况下,我如何绑定到隐藏字段?我认为此链接回答了问题,您可以执行类似var self=this的操作代码>执行此操作后,为什么要再次使用此
?与问题无关,只是一个建议
var app = angular.module('app');
app.controller('CashierController', function($scope, $state, $window, $localStorage, GatewayService) {
var self = this;
this.cashierUrl = "https://url.action";
this.token = $localStorage.cashierToken;
this.merchantId = '//';
this.customerId = $localStorage.customerId;
this.action = '//';
this.paysolName = 'CreditDebitCards';
console.log(this.cashierForm);
document.getElementById('cashier').submit();
this.goToPage = function(page) {
$state.go(page);
}
})