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