0
私はウェブ開発に新しいです、私が解決しようとしている問題は、非常に基本的なものですが、私は解決策が見つけられなかったためにたくさん検索しました。 私は以下の2つのWebページone
とtwo
角度2の投稿データを読む
を持っていることは、この上のフォームは、自動的に次のウェブページtwo.html
に掲示し、以下ComponentOne
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>
です
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
を使用してください。全く問題はありません。 サービスクラスなしでこれをどのように達成できますか?