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


TypeScript HttpParams.set方法代碼示例

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


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

示例1: listPage

  listPage(pageState: PageState): Observable<any> {
    let params = new HttpParams();
    params = params.set('pageNo', pageState.page.pageNo + '');
    params = params.set('pageSize', pageState.page.pageSize + '');
    Object.getOwnPropertyNames(pageState.filters).map(key => {
      let value = pageState.filters[key];
      if (isNotEmpty(value)) {
        params = params.set(key, value);
      }
    });
    let filterList: Array<string> = [];
    Object.getOwnPropertyNames(pageState.filters).map(key => {
      let value = pageState.filters[key];
      if (isNotEmpty(value)) {
        if (key === 'deleted' || key === 'id') {
          filterList.push(`${key}=${value}`)
        } else {
          filterList.push(`${key}__contains=${value}`);
        }
      }
    })
    if (filterList.length) {
      params = params.set('filter', filterList.join(','));
    }
    // sort param
    if (Object.keys(pageState.sort).length !== 0) {
      let sortType: any = pageState.sort.reverse ? `-${pageState.sort.by}` : pageState.sort.by;
      params = params.set('sortby', sortType);
    }

    return this.http
      .get('/api/v1/auditlogs', {params: params})

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

示例2: createTerminal

 createTerminal(appId: number, cluster: string, namespace: string, pod: string, container: string, cmd?: string): Observable<any> {
   let params = new HttpParams();
   params = params.set('container', container);
   params = params.set('cmd', cmd);
   return this.http
     .post(`/api/v1/kubernetes/apps/${appId}/pods/${pod}/terminal/namespaces/${namespace}/clusters/${cluster}`, null, {params: params})
     .catch(error => Observable.throw(error))
 }
開發者ID:jacky68147527,項目名稱:wayne,代碼行數:8,代碼來源:pod.ts

示例3: query

 query(pageState: PageState): Observable<any> {
   let params = new HttpParams();
   params = params.set('pageNo', pageState.page.pageNo + '');
   params = params.set('pageSize', pageState.page.pageSize + '');
   params = params.set('sortby', '-id');
   return this.http
     .get(`/api/v1/notifications`, {params: params})
     //
     .catch(error => Observable.throw(error))
 }
開發者ID:jacky68147527,項目名稱:wayne,代碼行數:10,代碼來源:notification.service.ts

示例4: subscribe

  subscribe(pageState: PageState): Observable<any> {
    let params = new HttpParams();
    params = params.set('pageNo', pageState.page.pageNo + '');
    params = params.set('pageSize', pageState.page.pageSize + '');
    params = params.set('sortby', '-id');
    // params = params.set('is_readed', pageState.params['is_readed'])
    return this.http
      .get(`/api/v1/notifications/subscribe`, {params: params})

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

示例5: getMunicipalities

  getMunicipalities(nom_com?, limit?) {
    let params: HttpParams = new HttpParams();

    if (nom_com) {
      params = params.set('nom_com', nom_com);
    }
    if (limit) {
      params = params.set('limit', limit);
    }

    return this._http.get<any>(`${AppConfig.API_ENDPOINT}/geo/municipalities`, { params: params });
  }
開發者ID:PnEcrins,項目名稱:GeoNature,代碼行數:12,代碼來源:data-form.service.ts

示例6: autocompleteTaxon

 autocompleteTaxon(api_endpoint: string, searh_name: string, params?: { [key: string]: string }) {
   let queryString: HttpParams = new HttpParams();
   queryString = queryString.set('search_name', searh_name);
   for (let key in params) {
     if (params[key]) {
       queryString = queryString.set(key, params[key]);
     }
   }
   return this._http.get<Taxon[]>(`${api_endpoint}`, {
     params: queryString
   });
 }
開發者ID:PnEcrins,項目名稱:GeoNature,代碼行數:12,代碼來源:data-form.service.ts

示例7: query

    query(req: any): Observable<HttpResponse<Audit[]>> {
        const params: HttpParams = createRequestOption(req);
        params.set('fromDate', req.fromDate);
        params.set('toDate', req.toDate);

        const requestURL = SERVER_API_URL + 'management/audits';

        return this.http.get<Audit[]>(requestURL, {
            params,
            observe: 'response'
        });
    }
開發者ID:hoangnv1203,項目名稱:discordbot,代碼行數:12,代碼來源:audits.service.ts

示例8: makeRequest

  private makeRequest(path: string) {
    let params = new HttpParams();
    params.set('per_page', '100');

    let url = `https://api.github.com/${path}`;
    return this.http.get(url, {params}).pipe(map(res => res));
  }
開發者ID:screenm0nkey,項目名稱:angular2-examples-webpack,代碼行數:7,代碼來源:github.http.ts

示例9: 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,代碼來源:

示例10: listEmbeddedApps

 listEmbeddedApps(backendId: string, tag?: EmbeddedAppTag) {
   let params = new HttpParams();
   if (tag) {
     params = params.set('tag', tag);
   }
   return this.http.get<EmbeddedApp[]>(`${RCCConfig.getRogerthatApiUrl(backendId)}/embedded-apps`, { params });
 }
開發者ID:our-city-app,項目名稱:plugin-mobicage-control-center,代碼行數:7,代碼來源:rogerthat-backends.service.ts


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