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


TypeScript URLSearchParams.set方法代码示例

本文整理汇总了TypeScript中angular2/http.URLSearchParams.set方法的典型用法代码示例。如果您正苦于以下问题:TypeScript URLSearchParams.set方法的具体用法?TypeScript URLSearchParams.set怎么用?TypeScript URLSearchParams.set使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在angular2/http.URLSearchParams的用法示例。


在下文中一共展示了URLSearchParams.set方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。

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

示例2: getData

    getData(lat, lng) {

        const searchParams = new URLSearchParams()
        searchParams.set('lat', lat);
        searchParams.set('lng', lng);

        return this.http.get(this.url, {search: searchParams})
                .map(res => res.json())
    }
开发者ID:aroget,项目名称:ng2-countries,代码行数:9,代码来源:weather.ts

示例3: search

 search (term: string) {
   var search = new URLSearchParams()
   search.set('action', 'opensearch');
   search.set('search', term);
   search.set('format', 'json');
   return this.jsonp
               .get('http://en.wikipedia.org/w/api.php?callback=JSONP_CALLBACK', { search })
               .map((request) => request.json()[1]);
 }
开发者ID:dasaki-gr,项目名称:angular2-coder,代码行数:9,代码来源:wikipediaservice.ts

示例4: getData

    getData(country, lang) {

        const searchParams = new URLSearchParams()
        searchParams.set('country', country);
        searchParams.set('lang', lang);

        return this.http.get(this.url, {search: searchParams})
                .map(res => res.json())
    }
开发者ID:aroget,项目名称:ng2-countries,代码行数:9,代码来源:country-details.ts

示例5: checkCategoryExistence

  checkCategoryExistence(parentId:string,categoryName:string){
    let params:URLSearchParams = new URLSearchParams();
    params.set('parentId', parentId.toString());
    params.set('categoryName', categoryName.toString());

    return this.http.get('/api/category/checkCategoryExistence', {
       search: params
    }).map(res => res.text());
  }
开发者ID:Skholastik,项目名称:BlackUnicorn,代码行数:9,代码来源:API_Category.service.ts

示例6: checkUser

    checkUser(username : string, password : string) : Observable<any> {
        let params : URLSearchParams = new URLSearchParams();
        params.set('username', username);
        params.set('password', password);

        return this._http.get('http://127.0.0.1:1337/user/checkLogin', {
            search : params
        }).map( res => res.json() );
    }
开发者ID:lakipn,项目名称:FlaVid,代码行数:9,代码来源:http.service.ts

示例7: loadAlbums

loadAlbums(id) {
    let params = new URLSearchParams('callback=JSONP_CALLBACK&entity=album');
    params.set('id', id);
    params.set('country', this.setting.country.code);
    return this.jsonp.request('https://itunes.apple.com/lookup', {
      search: params
    }).map (response => response.json().results)
      .map(results => results.filter((item) => item.collectionType === 'Album'));
  }
开发者ID:AllanSmithee83,项目名称:as-ionic2-iTunesApp,代码行数:9,代码来源:itunes.ts

示例8: getTopScores

    getTopScores() {
        const endpoint = 'https://api.mlab.com/api/1/databases/angular2-puzzle/collections/score?s={"time": 1}';
        const searchParams = new URLSearchParams();
        searchParams.set('apiKey', API_KEY);
        searchParams.set('l', "5");

        return this.http
            .get(endpoint, {search: searchParams})
            .map(res => res.json());
    }
开发者ID:kat-liger,项目名称:angular2-puzzle,代码行数:10,代码来源:score.service.ts

示例9: search

 search (term: string) {
     var search = new URLSearchParams()
     search.set('action', 'opensearch');
     search.set('search', term);
     search.set('format', 'json');
     return this.jsonp
         .get('http://en.wikipedia.org/w/api.php?callback=JSONP_CALLBACK', { search })
         .toPromise() // optional to convert Observable to Promise
         .then((request) => request.json()[1]);
 }
开发者ID:HansS,项目名称:ng2Boilerplate-born2net,代码行数:10,代码来源:WikiService.ts

示例10: Promise

    return new Promise((resolve, reject) => {
      var searchParams = new URLSearchParams();

      searchParams.set('imdbId', imdbId);
      searchParams.set('lang', lang);

      this.http.get(openSubtitlesBaseUrl, {search: searchParams}).subscribe(
        res => resolve(res),
        err => console.error(err)
      );
    });
开发者ID:Shpilevskyy,项目名称:movieMomentsSearch,代码行数:11,代码来源:subtitles.ts


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