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


TypeScript Jsonp.request方法代码示例

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


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

示例1: getWords

  getWords (limit: string): Promise<any>{
    let apiUrl = 'https://wordsquiz.herokuapp.com/select';
    let params = new URLSearchParams();
    params.set('limit', limit);
    params.set('callback', 'JSONP_CALLBACK');

    return this.jsonp.request(apiUrl, {search: params}).toPromise();
  }
开发者ID:ingpdw,项目名称:spellingQuiz,代码行数:8,代码来源:words.service.ts

示例2: search

  search(keyword) {

    return this.http.request(`http://redapesolutions.com/itunes?term=${keyword}&callback=JSONP_CALLBACK`)
        .map(res => res.json())
        .toPromise()
        .then(data => {
          return data.results
        })
  }
开发者ID:igzjuanrafaelperez,项目名称:iTunesBrowser,代码行数:9,代码来源:itunes.ts

示例3: 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
    }).toPromise()
      .then((response) => response.json().results);
  }
开发者ID:JPetronetto,项目名称:ionicSampleApp,代码行数:12,代码来源:itunes.ts

示例4: getPosts

 getPosts(): Observable<Array<any>> {
   if (this.posts) {
     return Observable.of(this.posts);
   }
   return this.jsonp
     .request('https://api.tumblr.com/v2/blog/satsukitv.tumblr.com/posts/text?callback=JSONP_CALLBACK&reblog_info=true&notes_info=true&api_key=FdXg500s7QtYKmBdk1EuFp4wGSQWWOPHnTF9bHd6gP3vrFTmQc')
     .map(res => {
       var posts: Array<any> = res.json().response.posts;
       localStorage.setItem('blog.posts', JSON.stringify(posts));
       this.posts = posts;
       return this.posts;
     });
 }
开发者ID:satsukitv,项目名称:satsuki.tv,代码行数:13,代码来源:tumblr.service.ts

示例5: constructor

 constructor(jsonp : Jsonp) {
     jsonp.request('https://www.highcharts.com/samples/data/jsonp.php?filename=aapl-c.json&callback=JSONP_CALLBACK').subscribe(res => {
         this.options = {
             title : { text : 'AAPL Stock Price' },
             series : [{
                 name : 'AAPL',
                 data : res.json(),
                 tooltip: {
                     valueDecimals: 2
                 }
             }]
         };
     });
 }
开发者ID:zeqk,项目名称:mapleapp,代码行数:14,代码来源:mcStockChart.ts

示例6: Promise

 return new Promise(resolve => {
   // We're using Angular Http provider to request the data,
   // then on the response it'll map the JSON data to a parsed JS object.
   // Next we process the data and resolve the promise with the new data.
   this.jsonp.request('http://api.douban.com/v2/movie/top250')
     .map(res => {
       res.json();
     })
     .subscribe(data => {
       // we've got back the raw data, now generate the core schedule data
       // and save the data for later reference
       this.data = data;
       resolve(this.data);
     });/**/
 });
开发者ID:RunningV,项目名称:DoubanMovies,代码行数:15,代码来源:movies-data.ts

示例7: loadAlbuns

  loadAlbuns(id) {
    console.log(this.country.code);
    let params = new URLSearchParams(
      'callback=JSONP_CALLBACK&entity=album'
    );
    params.set('id', id);
    params.set('country', this.country.code);

    return this.jsonp.request(
      'https://itunes.apple.com/lookup', {
        search: params
    }).toPromise()
      .then((response) => response.json().results)
      .then((results) => results.filter((item) => item.collectionType === 'Album'));
  }
开发者ID:JPetronetto,项目名称:ionicSampleApp,代码行数:15,代码来源:itunes.ts

示例8: getPost

 /**
  * Extract the first post from the list of posts returned.
  *
  * @returns {Observable} path The promise to get the post data.
  */
 getPost(): Observable<any> {
   let url = 'http://obscurejavascript.tumblr.com/api/read/json?callback=JSONP_CALLBACK';
   return this.jsonp.request(url).map(res => res.json().posts[0]);
 }
开发者ID:Jacob-Friesen,项目名称:portfolio_website,代码行数:9,代码来源:blog-remote.service.ts

示例9: getJsonp

 public getJsonp(url: string, params: Object): Promise<any[]> {
   return this.jsonp.request(`${url + this.prepareQueryString(params)}`)
                   .toPromise()
                   .then(this.extractData)
                   .catch(this.handleError);
 }
开发者ID:klauskpm,项目名称:diablo-api,代码行数:6,代码来源:api.service.ts

示例10: getClues

 getClues() {
     var url = 'http://frank-designs.com/clients/sgs-beacon-hunt/beaconData.json?callback=JSONP_CALLBACK';
     //var response = this.http.get(url).map(res => res.json());
     // var response = this.http.get(url);
     return this.jsonp.request(url).map(res => res.json());
 }
开发者ID:frankieali4,项目名称:beacon-scavenger-hunt,代码行数:6,代码来源:cluesService.ts


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