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