當前位置: 首頁>>代碼示例>>TypeScript>>正文


TypeScript http.HttpParams類代碼示例

本文整理匯總了TypeScript中@angular/common/http.HttpParams的典型用法代碼示例。如果您正苦於以下問題:TypeScript HttpParams類的具體用法?TypeScript HttpParams怎麽用?TypeScript HttpParams使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


在下文中一共展示了HttpParams類的10個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。

示例1: HttpParams

    getCompetitionById$(competitionId: string,
                        fields: string[] = []): Observable<Competition> {
        let params = new HttpParams();

        if (fields.length > 0) {
            params = params.set('fields', fields.join(','));
        }

        return this
            ._http
            .get<Competition>(`api/competitions/${competitionId}`, {params})
        ;
    }
開發者ID:fabienvauchelles,項目名稱:qscore,代碼行數:13,代碼來源:competitions.service.ts

示例2: list_environments

  public list_environments(pretty?: boolean): Observable<Environment[]>
  {
		let params = new HttpParams();
		if (pretty) {
		  params = params.set("pretty", pretty.toString());
		}
    let headers = new HttpHeaders();
		
    headers = headers.set('Accept', 'application/json');
    return this.http.get<Environment[]>(`${this.backend.url_for('api')}/clips/`, 
		  { headers: headers, params: params,
		    observe: 'body', responseType: 'json' })	;
	}
開發者ID:,項目名稱:,代碼行數:13,代碼來源:

示例3: get_graph

  public get_graph(pretty?: boolean): Observable<TransformsGraph>
  {
		let params = new HttpParams();
		if (pretty) {
		  params = params.set("pretty", pretty.toString());
		}
    let headers = new HttpHeaders();
		
    headers = headers.set('Accept', 'application/json');
    return this.http.get<TransformsGraph>(`${this.backend.url_for('api')}/transforms/graph`, 
		  { headers: headers, params: params,
		    observe: 'body', responseType: 'json' })	;
	}
開發者ID:,項目名稱:,代碼行數:13,代碼來源:

示例4: serialize

    serialize(obj: any): any {

        if(obj == null)
            return {};

        let params = new HttpParams();
        for (var key in obj) {
            if (obj.hasOwnProperty(key)) {
                var element = obj[key];
                params =  params.set(key, element);
            }
        }      
        return params;
    }
開發者ID:maartri,項目名稱:room,代碼行數:14,代碼來源:auth.service.ts

示例5: getAcquisitionFrameworks

 getAcquisitionFrameworks(params?: any) {
   let queryString: HttpParams = new HttpParams();
   if (params) {
     // tslint:disable-next-line:forin
     for (let key in params) {
       if (params[key] !== null) {
         queryString = queryString.set(key, params[key]);
       }
     }
   }
   return this._http.get<any>(`${AppConfig.API_ENDPOINT}/meta/acquisition_frameworks`, {
     params: queryString
   });
 }
開發者ID:PnEcrins,項目名稱:GeoNature,代碼行數:14,代碼來源:data-form.service.ts

示例6: get_image

  public get_image(id: string, pretty?: boolean): Observable<HttpResponse<string>>
  {
    if (id === null || id == undefined) {
      throw new Error("Required parameter id is null or undefined (get_image)");
    }
		let params = new HttpParams();
		if (pretty) {
		  params = params.set("pretty", pretty.toString());
		}
    let headers = new HttpHeaders();
		
    return this.http.get(`${this.backend.url_for('api')}/images/${encodeURIComponent(String(id))}`, 
		  { headers: headers, params: params,
		    observe: 'response', responseType: 'text' })	;
	}
開發者ID:,項目名稱:,代碼行數:15,代碼來源:

示例7: getFoodRegistrations

 public getFoodRegistrations(fromDate: Moment = null, toDate: Moment = null, slot: number = null) {
   const url = this.apiService.getApiUrl('/food-registrations');
   let params = new HttpParams();
   if (fromDate != null) {
     params = params.append('from', this.dates.toLink(fromDate));
   }
   if (toDate != null) {
     params = params.append('to', this.dates.toLink(toDate));
   }
   if (slot != null) {
     params = params.append('slot', slot.toString());
   }
   return this.http.get<FoodRegistration[]>(url, {params}).pipe(
     catchError(this.handleError)
   );
 }
開發者ID:PIWEEK,項目名稱:comocomo,代碼行數:16,代碼來源:food-registrations-api.service.ts

示例8: get_config

  public get_config(query?: string, pretty?: boolean): Observable<ConfigTree>
  {
		let params = new HttpParams();
		if (query) {
		  params = params.set("query", query.toString());
		}
		if (pretty) {
		  params = params.set("pretty", pretty.toString());
		}
    let headers = new HttpHeaders();
		
    headers = headers.set('Accept', 'application/json');
    return this.http.get<ConfigTree>(`${this.backend.url_for('api')}/config`, 
		  { headers: headers, params: params,
		    observe: 'body', responseType: 'json' })	;
	}
開發者ID:,項目名稱:,代碼行數:16,代碼來源:

示例9: getShellToken

  getShellToken(namespace: string, podName: string): Observable<any> {
    let headers = new HttpHeaders();
    const username = 'publicV1'
    const password = 'a1b2c3d4E'
    headers.append('Authorization', 'Basic ' + btoa(username + ':' + password));
    headers.append('Content-Type', 'application/x-www-form-urlencoded');
    const options: any = {'headers': headers};

    let urlSearchParams = new HttpParams();
    urlSearchParams.append('namespace', namespace);
    urlSearchParams.append('podName', podName);
    return this.http
      .post(`/api/v1/public/shell/token`, urlSearchParams, options)

      .catch(error => Observable.throw(error));
  }
開發者ID:jacky68147527,項目名稱:wayne,代碼行數:16,代碼來源:public.service.ts

示例10: get_skill

  public get_skill(id: string, pretty?: boolean): Observable<Skill>
  {
    if (id === null || id == undefined) {
      throw new Error("Required parameter id is null or undefined (get_skill)");
    }
		let params = new HttpParams();
		if (pretty) {
		  params = params.set("pretty", pretty.toString());
		}
    let headers = new HttpHeaders();
		
    headers = headers.set('Accept', 'application/json');
    return this.http.get<Skill>(`${this.backend.url_for('api')}/skiller/skills/${encodeURIComponent(String(id))}`, 
		  { headers: headers, params: params,
		    observe: 'body', responseType: 'json' })	;
	}
開發者ID:,項目名稱:,代碼行數:16,代碼來源:


注:本文中的@angular/common/http.HttpParams類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。