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


TypeScript Jsonp.get方法代碼示例

本文整理匯總了TypeScript中@angular/http.Jsonp.get方法的典型用法代碼示例。如果您正苦於以下問題:TypeScript Jsonp.get方法的具體用法?TypeScript Jsonp.get怎麽用?TypeScript Jsonp.get使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在@angular/http.Jsonp的用法示例。


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

示例1: get

  get(location:string) {
    var url = [
      "http://api.openweathermap.org/data/2.5/weather?q=",
      location,
      "&APPID=57d36da6b8187a992393dc6a0f4c96c3",
      "&callback=JSONP_CALLBACK"].join('')

    return this.jsonp.get(url)
      .map((res) => res.json())

  }
開發者ID:forwardadvance,項目名稱:angular2_ajax_demo,代碼行數:11,代碼來源:weather.service.ts

示例2: searchRaw

 searchRaw(term: string): Observable<string> {
   let search = new URLSearchParams();
   search.set('action', 'opensearch');
   search.set('search', term);
   search.set('format', 'json');
   let response: Observable<string> = this.jsonp.get('http://en.wikipedia.org/w/api.php?callback=JSONP_CALLBACK',
     { search }).map(res => res.json()[1]);
   // use this to demo for a case where flatMap fails to handle out of order response
   // if (term.length === 2) { return response.delay(2000); }
   return response;
 }
開發者ID:achristoph,項目名稱:angular2-starter,代碼行數:11,代碼來源:wikipedia.service.ts

示例3: getRandomPalette

    getRandomPalette():Observable<any>{    

        let params = new URLSearchParams();
        params.set('format', 'json');
        params.set('jsonCallback', 'JSONP_CALLBACK');
        params.set('showPaletteWidths', '1');

        return this.jsonp
                .get('http://www.colourlovers.com/api/palettes/random', {search: params})
                .map(this.extractData)
                .catch(this.handleError);    
    }
開發者ID:nbogie,項目名稱:colour-lovers-angular2-example,代碼行數:12,代碼來源:colour-lovers.service.ts

示例4: submitUserData

 submitUserData(data) {
   const endpoint = 'http://localhost:4000/auth/facebook';
   let params = new URLSearchParams();
   params.set('user', data); // the user's search value
   params.set('action', 'opensearch');
   params.set('format', 'json');
   params.set('callback', 'JSONP_CALLBACK');
   console.log(data);
   return this.jsonp
     .get(endpoint, { search : params})
     .map(res => res.json());
   }
開發者ID:run-eat-travel,項目名稱:view_central,代碼行數:12,代碼來源:login.ts

示例5: getInbound

  public getInbound(stopName: string): any {
    let baseUrl = 'http://realtime.mbta.com/developer/api/v2/schedulebystop';
    let params = new URLSearchParams();

    params.set('api_key', 'wX9NwuHnZU2ToO7GmGR9uw');
    params.set('format', 'jsonp');
    params.set('jsonpcallback', 'JSONP_CALLBACK');
    params.set('route', 'CR-Haverhill');
    params.set('stop', stopName);
    params.set('max_trips', '6');
    params.set('max_time', '1440');

    return this.jsonp.get(baseUrl, {search: params}).map(req => req.json().mode[0].route[0].direction[1].trip);
  }
開發者ID:kdimatteo,項目名稱:highlander,代碼行數:14,代碼來源:trains.service.ts

示例6: getResults

	getResults (name:string){
		var search = new URLSearchParams();
		search.set('action', "opensearch");
		search.set('search', name); //replace 'ma' for variable
		search.set('format', 'json');
		let rs = this.jsonp
					.get(
						'http://en.wikipedia.org/w/api.php?callback=JSONP_CALLBACK', 
						{ search }
					)
					.map(this.extractData);
		console.log(rs);
		return rs;
	}
開發者ID:mptorrejon,項目名稱:Angular2-Gulp,代碼行數:14,代碼來源:wiki.service.ts

示例7: get

  get(tag:string) {
    var url = [
      "http://api.flickr.com/services/feeds/photos_public.gne",
      '?tags=',
      tag,
      '&tagmode=any',
      '&format=json',
      '&jsoncallback=JSONP_CALLBACK',
    ].join('')

    return this.jsonp.get(url)
      .map((res) => res.json())

  }
開發者ID:forwardadvance,項目名稱:angular2_ajax_demo,代碼行數:14,代碼來源:flickr.service.ts

示例8: getOutboundTrain

  public getOutboundTrain(route: string): any {
    let baseUrl = 'http://realtime.mbta.com/developer/api/v2/schedulebyroutes';
    let params = new URLSearchParams();

    params.set('api_key', 'wX9NwuHnZU2ToO7GmGR9uw');
    params.set('format', 'jsonp');
    params.set('jsonpcallback', 'JSONP_CALLBACK');
    params.set('routes', route);
    params.set('max_trips', '6');
    params.set('max_time', '1440');

    return this.jsonp.get(baseUrl, {search: params}).map((req) => {
      let data = req.json();
      let rawOutbound = data.mode[0].route[0].direction[0].trip;
      return rawOutbound.filter(this.filterByStop);
     });
  }
開發者ID:kdimatteo,項目名稱:highlander,代碼行數:17,代碼來源:trains.service.ts

示例9: getSearchResults

  // Uses jsonp.get() to load a single JSON file
  getSearchResults(request: string) {
    var search = new URLSearchParams();
    search.set('api_key', GIANTBOMB_API_KEY);
    search.set('query', request);
    search.set('field_list', 'name,deck,number_of_user_reviews,site_detail_url');
    search.set('limit', '10');
    search.set('resources', 'game');
    search.set('format', 'jsonp');
    search.set('json_callback', 'JSONP_CALLBACK');

    let queryUrl = `${GIANTBOMB_API_SEARCH_URL}${search}`;
    this.jsonp.get(queryUrl)
              .map(res => res.json())
              .subscribe(data => this.data = data,
                          err => console.log(err),
                           () => console.log('Completed'));

    return this.data;
  }
開發者ID:coryginsberg,項目名稱:game-review-project,代碼行數:20,代碼來源:search.service.ts

示例10: getGameResults

  getGameResults(gameID:string) {
    var search = new URLSearchParams();
    search.set('api_key', GIANTBOMB_API_KEY);
    search.set('field_list', 'name,deck,developers');
    search.set('format', 'jsonp');
    search.set('json_callback', 'JSONP_CALLBACK');

    gameID += "/";

    let queryUrl = `${GIANTBOMB_API_GAME_URL}${gameID}${search}`;
    this.jsonp.get(queryUrl)
      .map(res => res.json())
      .subscribe(data => this.data = data,
        err => console.log(err),
        () => console.log('Completed'));

    // console.log(this.data + " this.data");
    
    return this.data;
  }
開發者ID:coryginsberg,項目名稱:game-review-project,代碼行數:20,代碼來源:search.service.ts


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