本文整理汇总了TypeScript中angular2/http.Jsonp类的典型用法代码示例。如果您正苦于以下问题:TypeScript Jsonp类的具体用法?TypeScript Jsonp怎么用?TypeScript Jsonp使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Jsonp类的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的TypeScript代码示例。
示例1: lookup
lookup(symbol: string) {
let url = `http://finance.yahoo.com/webservice/v1/symbols/${symbol}/quote?format=json&view=detail&callback=JSONP_CALLBACK`;
// .catch(...)
return this._jsonp.get(url)
.map(r => +r.json().list.resources[0].resource.fields.price);
}
开发者ID:ChrisFulstow,项目名称:angularity,代码行数:7,代码来源:stock.service.ts
示例2: 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
}).map(response => response.json().results);
}
开发者ID:AllanSmithee83,项目名称:as-ionic2-iTunesApp,代码行数:7,代码来源:itunes.ts
示例3: searchQuotes
searchQuotes(query: string): Observable<QuoteSearch[]> {
var search: URLSearchParams = new URLSearchParams();
search.set('query', query);
return this._jsonp.get('https://s.yimg.com/aq/autoc?region=US&lang=en-US&callback=JSONP_CALLBACK', {search})
.map((response: Response) => response.json().ResultSet.Result);
}
开发者ID:derekrjones,项目名称:portfolio,代码行数:7,代码来源:quote.service.ts
示例4: Error
.switchMap((): Observable<any> => {
console.log("Fetching", url);
return this.jsonp
.request(url)
.timeout(15000, new Error("Timed out"))
.map((res: any) => res.json());
})
开发者ID:fergusg,项目名称:oxfloodwatch,代码行数:7,代码来源:data-service.ts
示例5: getData
getData (symbol: string) {
let year = this.date.getFullYear();
let month = this.date.getMonth() + 1;
let day = this.date.getDate();
let startDate: string = [year - 1, month, day].join("-");
let endDate: string = [year, month, day].join("-");
let apiRootYahoo = "http://query.yahooapis.com/v1/public/yql?q=select%20*%20from%20yahoo.finance.historicaldata%20where%20symbol%20%3D%20%22";
// let apiRoot = "http://marketdata.websol.barchart.com/getHistory.json";
// var params = new URLSearchParams();
// params.set('key', '2bdfab4812fc5de3327d3495356cf383');
// params.set('symbol', symbol); // the user's search value
// params.set('type', 'daily');
// params.set('startDate', '20150311000000');
// params.set('format', 'json');
// params.set('callback', 'JSONP_CALLBACK');
//
// return this._jsonp
// .get(apiRoot, { search: params })
// .map(request => request.results.json());
let fullURL = apiRootYahoo + symbol + "%22%20and%20startDate%20%3D%20%22" + startDate + "%22%20and%20endDate%20%3D%20%22" + endDate + "%22&format=json&diagnostics=true&env=store%3A%2F%2Fdatatables.org%2Falltableswithkeys&callback=JSONP_CALLBACK";
return this._jsonp
.get(fullURL)
.map(request => request.json());
}
开发者ID:philipyoo,项目名称:trading-dashboard,代码行数:32,代码来源:stock-information.service.ts
示例6: URLSearchParams
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
示例7: 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
示例8: 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
示例9: search
search(term: string){
let 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()
.then((res) => res.json()[1]);
}
开发者ID:dilunika,项目名称:angular2,代码行数:11,代码来源:promise.wiki.service.ts
示例10: search
search(): any {
var search = new URLSearchParams();
//search.set('action', 'opensearch');
//search.set('search', term);
//search.set('format', 'json');
//return this.jsonp.get('./showcase/portlet/data.json', { search}).map((request) => request.json()[1]);
let url = './showcase/portlet/setting.json';
return this.jsonp
.get(url, {})
.map(request => this.result(request));
}
开发者ID:racktime,项目名称:glucosensWebApp,代码行数:11,代码来源:portletService.ts
注:本文中的angular2/http.Jsonp类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论