本文整理汇总了TypeScript中aurelia-http-client.HttpClient.get方法的典型用法代码示例。如果您正苦于以下问题:TypeScript HttpClient.get方法的具体用法?TypeScript HttpClient.get怎么用?TypeScript HttpClient.get使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类aurelia-http-client.HttpClient
的用法示例。
在下文中一共展示了HttpClient.get方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: activate
activate(params: any) {
return this.http.get(`/api/schedulers/${params.schedulerName}/jobs/history`).then(response => {
let model = response.content;
this.entries = model.historyEntries;
this.errorMessage = model.errorMessage;
});
}
示例2: activate
activate(params: any) {
var teamId = params.id;
return this.httpClient.get('./team/'+teamId)
.then(response => {
this.team = new TeamViewModel(response.content);
});
}
示例3: nameChanged
nameChanged(newValue) {
if (newValue.length > 0) {
this.httpClient.get('/hello/' + newValue).then((response) => {
this.result = response.content.Result;
});
} else {
this.result = '';
}
}
示例4: getAllUsers
getAllUsers() {
return this.http.get('https://api.nice.social/user/nicesummary')
.then((response: any) => {
return response.content.data;
}).catch((err: any) => {
this.ea.publish(new ApiStatus('Nice.Social API Issue', { status: 'error' }));
return 'berg';
});
}
示例5: getRandomUserId
getRandomUserId() {
return this.http.get('https://api.nice.social/user/nicesummary')
.then((response: any) => {
var randomIndex = randomInteger(response.content.data.length);
return response.content.data[randomIndex].user_id;
}).catch((err: any) => {
this.ea.publish(new ApiStatus('Nice.Social API Issue', { status: 'error' }));
return 'berg';
});
}
示例6: ApiStatus
.then(() => {
this.isRequesting = true;
return this.http.get(this.urlBuilder('lastposts', { id: this.state.tokenReturned.user.id, count: 1 })).then((response: any) => {
this.isRequesting = false;
this.ea.publish(new ApiStatus('Retrieved Last Post', { status: 'success' }));
return response.content.data;
}).catch((err: any) => {
this.isRequesting = false;
this.ea.publish(new ApiStatus('Unable to retrieve last post', { status: 'error' }));
return nouser.data;
});
});
示例7: activate
activate() {
return this.httpClient.get('./team')
.then(response => {
var teamsJson = response.content;
this.teams = new Array(teamsJson.length);
for (var i=0; i < teamsJson.length; i++) {
this.teams[i] = new TeamViewModel(teamsJson[i]);
}
});
}
示例8: getRandomUserId
getRandomUserId() {
this.isRequesting = true;
return this.http.get('user/nicesummary')
.then((response: any) => {
this.isRequesting = false;
return response.content.data[randomInteger(response.content.data.length)].name;
}).catch((err: any) => {
console.log("Nice.Social API Issue");
this.isRequesting = false;
return 'berg';
});
}
示例9: loadProfile
loadProfile(id: number, more: boolean) {
this.isRequesting = true;
return this.http.get(this.urlBuilder('users', { id: id, more: more }))
.then((response: any) => {
this.isRequesting = false;
this.ea.publish(new ApiStatus('Retrieved Profile', { status: 'success' }));
return response.content.data;
}).catch((err: any) => {
this.isRequesting = false;
this.ea.publish(new ApiStatus('Username not found, restoring known user', { status: 'error' }));
return nouser.data;
});
}
示例10: load
load(url: string, params: any) {
this.isRequesting = true;
return this.http.get(this.urlBuilder(url, params))
.then((response: any) => {
this.meta = response.content.meta;
this.isRequesting = false;
this.ea.publish(new ApiStatus(`Retrieved ${url}`, { status: 'success' }));
return response.content.data;
}).catch((err: any) => {
this.isRequesting = false;
this.ea.publish(new ApiStatus(`Unable to load ${url}`, { status: 'success' }));
return {};
});
}