【发布时间】:2017-07-19 07:27:00
【问题描述】:
我是 Web 开发的新手,也许我要解决的问题是一个非常基本的问题,但我在 Google 上搜索了很多,但找不到解决方案。
我有两个网页one 和two
下面是one.html
<form id="requestForm" #requestForm ngNoForm action="{{requestUrl}}" method="POST">
<div *ngIf="requestmodel">
<button class="btn-flat waves-effect waves-light transparent regNrmS2BN" type="submit" id="submitForm" style="color: transparent; background-color: transparent;">Pay</button>
<input type="hidden" name="name" [ngModel]="requestmodel.name" />
</div>
</form>
上面的表格会自动发布到下一个网页two.html,下面是用ComponentOne编写的代码
ngOnInit(): void {
this.requestmodel = this.requestService.getRequest();
this.requestUrl = 'http://localhost:3000/two';
this.submitMe();
}
submitMe() {
let me = this;
if ($('#submitForm') && $('#submitForm')[0])
$('#submitForm')[0].click();
else
setTimeout(function () { me.submitMe(); }, 100);
}
问题是我如何读取ComponentTwo 中的表单数据,并且要求我不应该使用Service,否则根本不会有任何问题。
那么,如果没有服务类,我怎么能做到这一点呢?
【问题讨论】:
标签: javascript html angularjs node.js post