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