http Post request with Typescript

前端 未结 3 618
旧巷少年郎
旧巷少年郎 2021-02-19 02:15

I am trying to find an example of HTTP post request in Typescript but can only find examples that use Angular. Could someone point me in the right direction to find this or post

3条回答
  •  执笔经年
    2021-02-19 02:46

    Sending form data.

    Save(model: yourmodalarray[]): Observable {
    
            var formData: FormData = new FormData();
    
            formData.append('id', '');
     const headers = new Headers({
                'Accept': 'application/json',
                'enctype': 'multipart/form-data'
            });
            const options = new RequestOptions({ headers: headers });
    
    
            return this._http
                .post(this._baseUrl + 'Save', formData, options)
                .map(res => res.json())
                .catch(this.handleError);
    
        }
    

提交回复
热议问题