本文整理匯總了TypeScript中angular2/http.Jsonp.get方法的典型用法代碼示例。如果您正苦於以下問題:TypeScript Jsonp.get方法的具體用法?TypeScript Jsonp.get怎麽用?TypeScript Jsonp.get使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類angular2/http.Jsonp
的用法示例。
在下文中一共展示了Jsonp.get方法的10個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。
示例1: searchRx
searchRx (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((response) => response.json()[1]);
}
示例2: 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));
}
示例3: 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]);
}
示例4: rawSearch
rawSearch(searchParam:string) {
console.log('HeroService:wikiSearch ', searchParam);
let search:URLSearchParams = new URLSearchParams();
search.set('action', 'opensearch');
search.set('search', searchParam);
search.set('format', 'json');
return this.jsonp.get('http://en.wikipedia.org/w/api.php?callback=JSONP_CALLBACK', {search})
.map((res) => res.json()[1]);
}
示例5: search
search(term: string) {
let wikiSearchUrl = 'http://en.wikipedia.org/w/api.php';
var searchParams = new URLSearchParams();
searchParams.set('action', 'opensearch');
searchParams.set('search', term);
searchParams.set('format', 'json');
searchParams.set('callback', 'JSONP_CALLBACK');
return this.jsonp
.get(wikiSearchUrl, {search: searchParams})
.map((request) => request.json()[1]);
}
示例6: method
method(name, params = {}) {
return this._jsonp
.get(`${API_URL}${name}?${this.getParams(params)}`)
.map(res => res.json())
.filter(res => {
if (res.response) {
return res;
} else {
this._errService.pushError(res.error.error_msg);
if (res.error && res.error.error_code == 6) {
return res;
}
}
})
}
示例7: search
search(term: String) {
let wikiSearchUrl = 'http://en.wikipedia.org/w/api.php';
var searchParams = new URLSearchParams();
searchParams.set('action', 'opensearch');
searchParams.set('search', term);
searchParams.set('format', 'json');
searchParams.set('callback', 'JSONP_CALLBACK');
return this.jsonp
.get(wikiSearchUrl, {search: searchParams})
.toPromise()
//.then((response) => console.log(response.json()[1]));
.then((response) => response.json()[1]);
}
示例8: constructor
constructor(jsonp: Jsonp) {
jsonp.get('./people.json?callback=JSONP_CALLBACK').subscribe(res => this.people = res.json());
}
示例9: displaySubreddit
private displaySubreddit(subreddit: string) {
this.feedData = this.jsonp.get("http://reddit.com/r/aww.json?jsonp=JSONP_CALLBACK")
.map(response => (response.json() as ApiResponse).data.children)
.map(submissions => submissions.map(val => val.data));
}
示例10: displaySubreddit
private displaySubreddit(subreddit: string) {
this.feedData = this.jsonp
.get("http://reddit.com/r/aww.json?jsonp=JSONP_CALLBACK")
.map(res => (res.json() as ApiResponse).data.children.map(child => child.data));
}