本文整理汇总了TypeScript中angular2/http.URLSearchParams.append方法的典型用法代码示例。如果您正苦于以下问题:TypeScript URLSearchParams.append方法的具体用法?TypeScript URLSearchParams.append怎么用?TypeScript URLSearchParams.append使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类angular2/http.URLSearchParams
的用法示例。
在下文中一共展示了URLSearchParams.append方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: urlEncode
export function urlEncode(obj: Object): string {
let urlSearchParams = new URLSearchParams();
for (let key in obj) {
if (0)
urlSearchParams.append(key, urlEncode(obj[key]))
else {
urlSearchParams.append(key, obj[key]);
}
}
return urlSearchParams.toString();
}
示例2: URLSearchParams
export const objToSearchParams = (obj:any):URLSearchParams => {
let params = new URLSearchParams();
for (let k in obj) {
if(obj[k]) params.append(k, obj[k]);
}
return params;
};
示例3: toParamsString
export function toParamsString(params: any) {
let urlSearchParams = new URLSearchParams();
for (let key in params) {
urlSearchParams.append(key, params[key]);
};
return urlSearchParams.toString();
}
示例4: searchByCoords
searchByCoords(latitude: number, longitude: number, page: number = 1) : Observable<any> {
let searchParams: URLSearchParams = new URLSearchParams();
searchParams.append("country", "uk");
searchParams.append("pretty", "1");
searchParams.append("action", "search_listings");
searchParams.append("encoding", "json");
searchParams.append("listing_type", "buy");
searchParams.append("page", page.toString());
searchParams.append("centre_point", "" + latitude + "," + longitude);
const response: Observable<Response> = this._http.get(Config.apiUrl, { search: searchParams });
return response.map(res => res.json()).map(
data => data.response
);
}
示例5: search
search(location: string, page: number = 1) : Observable<any> {
let searchParams: URLSearchParams = new URLSearchParams();
searchParams.append("country", "uk");
searchParams.append("pretty", "1");
searchParams.append("action", "search_listings");
searchParams.append("encoding", "json");
searchParams.append("listing_type", "buy");
searchParams.append("page", page.toString());
searchParams.append("place_name", location);
const response: Observable<Response> = this._http.get(Config.apiUrl, { search: searchParams });
return response.map(res => res.json()).map(
data => data.response
);
}
示例6: createUrlSearchParams
static createUrlSearchParams(select: string, orderBy: string, expand: string, filter: string, top: number, skip: number, count: boolean): URLSearchParams {
let urlSearchParams = new URLSearchParams();
if (select)
urlSearchParams.set('$select', select);
if (orderBy)
urlSearchParams.set('$orderby', orderBy);
if (expand)
urlSearchParams.set('$expand', expand);
if (filter)
urlSearchParams.set('$filter', filter);
if (top)
urlSearchParams.set('$top', top.toString());
if (skip)
urlSearchParams.set('$skip', skip.toString());
if (count)
urlSearchParams.append('$count', 'true');
return urlSearchParams;
}
示例7: deleteTodo
deleteTodo(deletedTodo: Todo) {
let params = new URLSearchParams();
params.append('id', '' + deletedTodo.id );
return this.http.delete('/todo', {search: params});
}
示例8: deletePhoto
deletePhoto(deletedPhoto: any) {
let params = new URLSearchParams();
params.append('id', '' + deletedPhoto.id );
return this.http.delete(this.base_url, {search: params});
}
示例9: deleteComment
deleteComment(deletedComment: any) {
let params = new URLSearchParams();
params.append('id', '' + deletedComment.id );
return this.http.delete(this.base_url, {search: params});
}