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


TypeScript Http.put方法代码示例

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


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

示例1: saveStory

    saveStory(userId, story:Story):Observable<Story> {
        let headers = new Headers({
            'Content-Type': 'application/x-www-form-urlencoded'
        });

        let options = new RequestOptions({
            headers: headers
        });
        story.userId = userId;

        if (!!story._id) {
            story.createdAt = story.createdAt || (new Date());
            story.lastModifiedAt = (new Date());
            return this.http.put(this.configuration.apiBasePath + '/story/' + userId + '/'+ story._id , "data=" + JSON.stringify(story), options)
                .map(res => res.json())
                .catch(this.logger.errorCatcher());
        }
        else {
            story.createdAt = (new Date());
            story.lastModifiedAt = (new Date());
            return this.http.post(this.configuration.apiBasePath + '/story/' + userId + '/', "data=" + JSON.stringify(story), options)
                .map(res => res.json())
                .catch(this.logger.errorCatcher());
        }
    }
开发者ID:FrancescoFontana,项目名称:chronostories,代码行数:25,代码来源:story.service.ts

示例2: getUseRestriction

 getUseRestriction(questions: string): Observable<Response> {
     let headers = new Headers();
     headers.append('Content-Type', 'application/json');
     return this.http.put(AppSettings.DAR_USERESTRICTION_ENDPOINT, questions, {
         headers: headers
     });
 }
开发者ID:dags,项目名称:match-tool,代码行数:7,代码来源:dar.service.ts

示例3: update

	update(form: Form) {
		return this._http.put(
			Config.api('form/'+form.id),
			JSON.stringify(form),
			this.headers()
		);	
	}
开发者ID:myste1tainn,项目名称:any.form-php,代码行数:7,代码来源:form.service.ts

示例4: saveSelectionForComp

 saveSelectionForComp(compId:String, selection:Selection):Observable<Response> {
     // /auth/ URLs are protected by the middleware
     return this._http.put(BASE_URL + '/auth/competition/selection/push/' + compId, JSON.stringify(selection), {
             headers: json()
         })
         .share();
 }
开发者ID:jamesmorgan,项目名称:ng2-picks,代码行数:7,代码来源:CompetitionApi.ts

示例5: updatePerson

    updatePerson(data: string, http: Http) {
        var config = new Config();
        let headers = new Headers({ 'Content-Type': 'application/json' });
        var options = new RequestOptions({ headers: headers });

        return http.put(config.apiBaseUrl + "People", data, options).toPromise();
    };
开发者ID:mberaz,项目名称:angular2-EF-core,代码行数:7,代码来源:people.service.ts

示例6: saveBlog

 saveBlog(blog: BlogEntry): Observable<Response> {
     if (blog.id) {
         return this.http.put('/api/blogs/' + blog.id, blog.json(), this.opts);
     } else {
         return this.http.post('/api/blogs', blog.json(), this.opts);
     }
 }
开发者ID:liuyijie,项目名称:angular2-webpack-demo-routing-and-http,代码行数:7,代码来源:blog-service.ts

示例7: 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

示例8: updateGame

 updateGame(game: Game) {
     this.http.put(`${BASE_URL}/${game.id}`, JSON.stringify(game), HEADER)
         .subscribe(
             action => this.store.dispatch({ type: 'UPDATE_GAME', payload: game }),
             error => console.log('Error: ' + error)
         );
 }
开发者ID:elqsar,项目名称:angular2-simple-starter,代码行数:7,代码来源:game.service.ts

示例9: update

 update(band: Band) {
     return this._http.put(this.baseAPIUrl + 'band/' + band.id + '/', JSON.stringify({
         name: band.name,
         description: band.description
     }), this.getHeaders())
         .map(res => res.json())
 }
开发者ID:YetAnotherTeam,项目名称:jatumba-frontend,代码行数:7,代码来源:band.service.ts

示例10: addContenido

 //AĂąadir contenido al usuario
 addContenido(producto: Prod, usuario: Usuario){
   usuario.coleccion.push(producto);
   if(producto.tipoprod == 3){
     usuario.nPelis = usuario.nPelis + 1;
   }
   if(producto.tipoprod == 2){
     usuario.nSeries = usuario.nSeries + 1;
   }
   if(producto.tipoprod == 1){
     usuario.nJuegos = usuario.nJuegos + 1;
   }
   let cambio = JSON.stringify(usuario);
   let headers = new Headers({
     'Content-Type': 'application/json',
     'X-Requested-With': 'XMLHttpRequest'
   });
   let options = new RequestOptions({headers});
   return this.http.put(BASE_URL + usuario.id, cambio, options)
   .map(
     response => response.json()
   )
   .catch(
     error => this.handleError(error)
   );
 }
开发者ID:Alvaro95pa,项目名称:daw_web,代码行数:26,代码来源:usuario.service.ts


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