当前位置: 首页>>代码示例>>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;未经允许,请勿转载。