我在写角形日历。我想要等待HTTP响应之前,组件加载角-5。
日历component.ts :-
我想用this.totallist显示服务中的数据,
events: CalendarEvent[] = this.totallist; // I have show data here which is fetched from database.
ngOnInit() {
this.eventlist.getEvents().subscribe(
data => {
console.log(data);
我的android应用程序出了点问题。我是个新手,在寻找正确的异步文档时遇到了一些问题。我正在使用kohttp库来帮助我。 问题是,你不能在主UI线程上运行它,所以我想让这个请求异步。我在文档中找不到明确的参考,我也不知道如何用普通的Kotlin来做这件事。 这就是我想出来的;在一个名为LoginCall的单独类中。我尝试了其他的答案,但是没有成功。我如何在一个新的线程上运行它,同时仍然使用响应? class LoginCall {
fun callLoginRequest(a:String, b:String): Any {
val response: R
下面是一个角度错误处理/日志记录教程:
我的问题是-如何从我的服务中调用handleError方法(驻留在下面第3步中的global-error-handler.service.ts文件中)?
在我的ErrorLogService中,我还实例化了一个POST请求(来自组件的数据),并使用catchError尝试从global-error-handler.service.ts调用handleError,但我得到了[ts] Property 'handleError' does not exist on type 'typeof GlobalErrorHandler'
我正在使用来自'@angular/common/http'的新的'@angular/common/http'。我的组件和服务设置如下:
component.ts
public async saveComment() {
this._service.postComment(this.comment);
// I want to wait for the post to complete and then update my comments list below
this.comments = await this._service.g