当前位置: 首页>>代码示例>>TypeScript>>正文


TypeScript URLSearchParams.append方法代码示例

本文整理汇总了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();
}
开发者ID:DominikDitoIvosevic,项目名称:BananaBlade,代码行数:11,代码来源:utilities.ts

示例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;
};
开发者ID:windwang,项目名称:angular2-app,代码行数:7,代码来源:helpers.ts

示例3: toParamsString

export function toParamsString(params: any) {
  let urlSearchParams = new URLSearchParams();
  for (let key in params) {
    urlSearchParams.append(key, params[key]);
  };
  return urlSearchParams.toString();
}
开发者ID:billgate,项目名称:angular2-reactive-examples,代码行数:7,代码来源:toParamsString.ts

示例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
           );
  }     
开发者ID:darojuv,项目名称:PropertyCross,代码行数:14,代码来源:search-service.ts

示例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
             );
    }  
开发者ID:darojuv,项目名称:PropertyCross,代码行数:14,代码来源:search-service.ts

示例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;
  }
开发者ID:huynhtri0626,项目名称:angular2-webpack-starter,代码行数:19,代码来源:HttpHelper.ts

示例7: deleteTodo

    deleteTodo(deletedTodo: Todo) {
        let params = new URLSearchParams();
        params.append('id', '' + deletedTodo.id );

        return this.http.delete('/todo', {search: params});
    }
开发者ID:dmattsson,项目名称:angular2-rxjs-single-atom-example,代码行数:6,代码来源:TodoService.ts

示例8: deletePhoto

    deletePhoto(deletedPhoto: any) {
        let params = new URLSearchParams();
        params.append('id', '' + deletedPhoto.id );

        return this.http.delete(this.base_url, {search: params});
    }
开发者ID:danielgolub,项目名称:Instagram-Clone,代码行数:6,代码来源:photo.ts

示例9: deleteComment

    deleteComment(deletedComment: any) {
        let params = new URLSearchParams();
        params.append('id', '' + deletedComment.id );

        return this.http.delete(this.base_url, {search: params});
    }
开发者ID:danielgolub,项目名称:Instagram-Clone,代码行数:6,代码来源:comment.ts


注:本文中的angular2/http.URLSearchParams.append方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。