當前位置: 首頁>>代碼示例>>TypeScript>>正文


TypeScript http.URLSearchParams類代碼示例

本文整理匯總了TypeScript中angular2/http.URLSearchParams的典型用法代碼示例。如果您正苦於以下問題:TypeScript URLSearchParams類的具體用法?TypeScript URLSearchParams怎麽用?TypeScript URLSearchParams使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


在下文中一共展示了URLSearchParams類的10個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。

示例1: searchQuotes

  searchQuotes(query: string): Observable<QuoteSearch[]> {

    var search: URLSearchParams = new URLSearchParams();
    search.set('query', query);
    return this._jsonp.get('https://s.yimg.com/aq/autoc?region=US&lang=en-US&callback=JSONP_CALLBACK', {search})
          .map((response: Response) => response.json().ResultSet.Result);
  }
開發者ID:derekrjones,項目名稱:portfolio,代碼行數:7,代碼來源:quote.service.ts

示例2: makeRequest

	private makeRequest(path: string){
		let params = new URLSearchParams();
		params.set('per_page', '100');
		let url = `https://api.github.com/${path}`;
		return this.http.get(url, {search: params})
			.map((res) => res.json());
	}
開發者ID:ArnoldKrumins,項目名稱:euroadmin,代碼行數:7,代碼來源:github.ts

示例3: getArtistTopTracks

  /**
   * Get Spotify catalog information about an artist’s top tracks by country.
   * @param  {string}              id      [description]
   * @param  {string}              country [description]
   * @return {Observable<Track[]>}         [description]
   */
  getArtistTopTracks (id: string, country: string = 'ES'): Observable<Track[]> {
    let params = new URLSearchParams();
    params.set('country', country);

    return this._httpSpotifyApi.get(`/artists/${id}/top-tracks`, { search: params })
      .map(res => this._mapper.responseToTracks(res));
  }
開發者ID:maurosabatino,項目名稱:angular2-spotify,代碼行數:13,代碼來源:artists.service.ts

示例4: search

 search(keyword) {
   let params = new URLSearchParams('callback=JSONP_CALLBACK');
   params.set('term', keyword);
   return this.jsonp.request('https://itunes.apple.com/search', {
     search: params
   }).map(response => response.json().results);
 }
開發者ID:AllanSmithee83,項目名稱:as-ionic2-iTunesApp,代碼行數:7,代碼來源:itunes.ts

示例5: search

 search (term: string) {
     var search = new URLSearchParams()
     search.set('text', term);
     return this.http
         .get('http://lararest.2ezweb.com.au/', { search })
         .map((request) => request.json());
 }
開發者ID:Mihai-P,項目名稱:laravel-angular,代碼行數:7,代碼來源:rest-service.ts

示例6: makeSearchRequest

	private makeSearchRequest(path: string,
    searchFor: string,
    page: string,
    perPage: string,
    parameters: Map<string, any>){
            
      let searchCriteria = this.flattenMap(parameters, 
        '+',
        true);
        
      console.log(searchCriteria);   
        
      let params = new URLSearchParams();

      params.set('q', searchFor + '+' + searchCriteria);
      params.set('page', page);
      params.set('per_page', perPage);
      
      let url = `https://api.github.com/search/${ path }`;
      
      return this.http.get(url, {search: params})
        .map((res) => res.json().items)
        .do(data => {console.log('All: ' + JSON.stringify(data))})
        .catch(this.handleError);
	}  
開發者ID:gthio,項目名稱:dojo-angularjs2-github-browser,代碼行數:25,代碼來源:github.ts

示例7: getData

    getData(query) {

        const searchParams = new URLSearchParams()
        searchParams.set('name', query);
        return this.http.get(this.url, {search: searchParams})
                .map(res => res.json())
    }
開發者ID:aroget,項目名稱:ng2-countries,代碼行數:7,代碼來源:main-search.ts

示例8: 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

示例9: 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

示例10: getArtists

  /**
   * Get Spotify catalog information for several artists based on their Spotify IDs.
   * @param  {string[]}             ids [description]
   * @return {Observable<Artist[]>}     [description]
   */
  getArtists (ids: string[]): Observable<Artist[]> {
    let params = new URLSearchParams();
    params.set('ids', ids.join(','));

    return this._httpSpotifyApi.get(`/artists`, { search: params })
      .map(res => this._mapper.responseToArtists(res));
  }
開發者ID:maurosabatino,項目名稱:angular2-spotify,代碼行數:12,代碼來源:artists.service.ts


注:本文中的angular2/http.URLSearchParams類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。