本文整理匯總了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 });
}