私はAngular 2とフォームコンセプトを全く新しくしています。 POST API呼び出しにフォームデータをPOSTしようとしています。 http://localohot:8080/ **********角2:フォームを使用してPOST呼び出しを行う方法
コンポーネント:この
POSTのAPIのようにここで
user: any = {
id: null,
gender: null,
mstatus: null,
birthdate: null,
bloodgroup: null
}
userName: any = {
id: null,
personId: null,
displayName: '',
prefix: null,
givenName: null
}
userAddressJSON: any = {
id: null,
personId: null,
address1: null,
address2: null,
cityVillage: null
}
var form = new FormData();
form.append('userid', new Blob(['' + uid], { type: 'application/json' }));
form.append('user', new Blob([JSON.stringify(this.user)], { type: 'application/json' }));
form.append('userName', new Blob([JSON.stringify(this.userName)], { type: 'application/json' }));
form.append('userAddress', new Blob([JSON.stringify(this.userAddressJSON)], { type: 'application/json' }));
、私はAPI呼び出しを行う方法がわかりません。 古いアプリケーションでは、jQueryでフォームデータPOSTを使用していました。今、私は古いアプリケーションでフォームのPOSTを行うと、彼らはいずれかが2角度
にそのフォームのPOSTを行う方法を手伝ってくれる このような------WebKitFormBoundarybAWvwmP2VtRxvKA7
Content - Disposition: form - data; name = "userid"; filename = "blob"
Content - Type: application/json
------WebKitFormBoundarybAWvwmP2VtRxvKA7
Content - Disposition: form - data; name = "user"; filename = "blob"
Content - Type: application/json
------WebKitFormBoundarybAWvwmP2VtRxvKA7
Content - Disposition: form - data; name = "userName"; filename = "blob"
Content - Type: application/json
------WebKitFormBoundarybAWvwmP2VtRxvKA7
Content - Disposition: form - data; name = "userAddress"; filename = "blob"
Content - Type: application/json
を送信している角度2で同じことをしようとしています
公式の文書https://angular.io/docs/ts/latest/guide/server-communication.htmlをご覧ください。 – abhishekkannojia
angular2のドキュメントは非常に優れており、非常に詳細です。ステップチュートリアル。私はまずそれを見るだろう。 – Igor