当前位置: 首页>>代码示例>>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;未经允许,请勿转载。