For a specific use case I have to submit a single form the "old way".(对于特定用例,我必须以“旧方式”提交单个表单。)
Means, I use a form with action="".(意思是,我使用带有action =“”的表单。) The response is streamed, so I am not reloading the page.(响应是流式传输的,所以我没有重新加载页面。) I am completely aware that a typical AngularJS app would not submit a form that way, but so far I have no other choice.(我完全知道一个典型的AngularJS应用程序不会以这种方式提交表单,但到目前为止我别无选择。)
That said, i tried to populate some hidden fields from Angular:(也就是说,我试图从Angular填充一些隐藏的字段:)
<input type="hidden" name="someData" ng-model="data" /> {{data}}
Please note, the correct value in data is shown.(请注意,显示数据中的正确值。)
The form looks like a standard form:(表单看起来像标准形式:)
<form id="aaa" name="aaa" action="/reports/aaa.html" method="post">
...
<input type="submit" value="Export" />
</form>
If i hit submit, no value is sent to the server.(如果我点击提交,则不会向服务器发送任何值。) If I change the input field to type "text" it works as expected.(如果我将输入字段更改为键入“text”,它将按预期工作。) My assumption is the hidden field is not really populated, while the text field actually is shown due two-way-binding.(我的假设是隐藏字段没有真正填充,而文本字段实际上是由于双向绑定显示的。)
Any ideas how I can submit a hidden field populated by AngularJS?(有关如何提交由AngularJS填充的隐藏字段的任何想法?)
ask by Christian translate from so
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…