本文整理汇总了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;未经允许,请勿转载。 |
请发表评论