當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。