本文整理汇总了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))
}
示例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))
}
示例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))
}
示例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))
}
示例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 });
}
示例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
});
}
示例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'
});
}
示例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));
}
示例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' }) ;
}
示例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 });
}