当前位置: 首页>>代码示例>>TypeScript>>正文


TypeScript Http.patch方法代码示例

本文整理汇总了TypeScript中angular2/http.Http.patch方法的典型用法代码示例。如果您正苦于以下问题:TypeScript Http.patch方法的具体用法?TypeScript Http.patch怎么用?TypeScript Http.patch使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在angular2/http.Http的用法示例。


在下文中一共展示了Http.patch方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。

示例1: createRequest

 private createRequest(type: string,data ?: Object) : Observable<any> {
   let _url : string = this.buildUrl(data);
   let _request : Observable<any>
   let stringParam : string = '';
   let _jsonBuild : any = {}
   if(_url.split('?')[1] && _url.split('?')[1].length) {
     (_url.split('?')[1].split('&')).forEach( _paramPart => {
       _jsonBuild[_paramPart.split('=')[0]] = _paramPart.split('=')[1]; 
     });
     stringParam = JSON.stringify(_jsonBuild);
   }
   switch (type) {
     case "post":
       _request = this._http.post(_url.split('?')[0], stringParam);
       break;
     case "patch":
       _request = this._http.patch(_url.split('?')[0], stringParam);
       break;
     case "put":
       _request = this._http.put(_url.split('?')[0], stringParam);
       break;
     case "delete":
       _request = this._http.delete(_url);
       break;
     case "head":
       _request = this._http.head(_url);
       break;
     default:
       _request = this._http.get(_url);
       break;
   }
   this._request = _request.map((response: Response) => response.json());
   return this._request;
 }
开发者ID:iloveyo123u1,项目名称:ng2-resource,代码行数:34,代码来源:index.ts

示例2: follow

 follow(link: XLink) {
     console.log(link);
     if (link.method == "PATCH") {
         this.http.patch(link.href, "")
             .subscribe(resp => console.log(resp));
     } else if (link.method == "DELETE")
         this.http.delete(link.href)
             .subscribe(resp => console.log(resp));
 }
开发者ID:TaaviGilden,项目名称:testExam,代码行数:9,代码来源:phrs-listing.component.ts

示例3: changePassword

    changePassword(form) {
        
        let credentials = {
            old_password: form.value.old_password ? form.value.old_password : "",
            new_password: form.value.new_password ? form.value.new_password : "",
            confirm_new_password: form.value.confirm_new_password ? form.value.confirm_new_password : ""
        };

        let headers = new Headers();
        headers.append('Content-Type', 'application/json');

        return this._http.patch('/password', JSON.stringify(credentials), {
            headers: headers
        }).map(res => res.json());

    }
开发者ID:michaelsdennis4,项目名称:my_project_manager,代码行数:16,代码来源:profile.service.ts

示例4: updateProfile

    updateProfile(form) {

        let credentials = {
            email: form.value.email,
            first_name: form.value.first_name,
            last_name: form.value.last_name
        };
        
        let headers = new Headers();
        headers.append('Content-Type', 'application/json');

        return this._http.patch('/users', JSON.stringify(credentials), {
            headers: headers
        }).map(res => res.json());

    }
开发者ID:michaelsdennis4,项目名称:my_project_manager,代码行数:16,代码来源:profile.service.ts

示例5: update

    /**update a question*/
    public update(entity:T, onComplete?:() => void) {
        var headers:Headers = SecurityUtils.tokenHeaders();
        headers.append('Content-Type', 'application/json');

        this.http.patch(BaseService.getServerUrl() + this.getUrl()+"/"+this.getId(entity), JSON.stringify(entity), {
                headers: this.getSecurityHeaders()
            })
            .map(res => res.json())
            .subscribe(
                data => console.log('data = ' + data),
                err => console.log(err),
                () => {
                    console.log('Patch complete');
                    if (onComplete) {
                        onComplete();
                    };
                }
            );
        console.log('Question saved');
    }
开发者ID:cegagnevin,项目名称:sido,代码行数:21,代码来源:BaseService.ts

示例6: patch

	patch(url: string, body: string, options?: RequestOptionsArgs): Observable<Response>
	{
		url = this.getApiRoot() + url;
		return this.chainLoader(this.http.patch(url, body, options));
	}
开发者ID:nhurman,项目名称:Lorre,代码行数:5,代码来源:api.ts

示例7: patch

 patch(url: string, body: string, options?: RequestOptionsArgs): Observable<Response> {
     url = this.buildUrl(url);
     options = this.prepareOptions(options);
     return this._http.patch(url, body, options);
 }
开发者ID:artiso-solutions,项目名称:vokabelchef-web,代码行数:5,代码来源:authenticatedHttp.ts

示例8: like

 like(item) {
   let body = JSON.stringify({ likes : item.likes });
   let headers = new Headers({'Content-Type' : 'application/json'});
   let options = new RequestOptions({headers : headers});
   return this.http.patch(itemsURL + item.id, body, options).map(res => res.json()).catch(this.handleError);
 }
开发者ID:dicastro,项目名称:ionic2-tutorial,代码行数:6,代码来源:item-service.ts

示例9: patch

 patch(url:string, body:string, options?:RequestOptionsArgs):Observable<Response> {
   return this.http.patch(url, body, mergeAuthToken(options));
 }
开发者ID:hollannikas,项目名称:ssoidh-angular2,代码行数:3,代码来源:http-client.ts

示例10: update

 public update(invoice:Invoice):Observable<Response> {
     return this.http.patch('/api/invoice/'+invoice.id, JSON.stringify(invoice));
 }
开发者ID:jakari,项目名称:invoicing,代码行数:3,代码来源:invoice.service.ts


注:本文中的angular2/http.Http.patch方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。