Angular 6 HttpClient API请求未发出

问题描述

我在Angular 6中有一个具有以下功能的ApiService:

 add(data,string: string,type): Observable<Object | Response> {
    return this._http.post(this.url + string,data).pipe(
      tap(() => this.log(`added ${type} successfully`)),catchError(this.handleError<Response>(`Adding ${type}`))
    );
 }

函数在组件中的调用如下:

this.api.add(this.parent,'parents/new','Parent').subscribe(() => {
 this.authService.login(this.user,'login').subscribe();
 this.router.navigate(['/register/student']);
});

即使我已订阅Observable,对api的调用也完全不会触发。请帮我。谢谢

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)

相关问答

Selenium Web驱动程序和Java。元素在(x,y)点处不可单击。其...
Python-如何使用点“。” 访问字典成员?
Java 字符串是不可变的。到底是什么意思?
Java中的“ final”关键字如何工作?(我仍然可以修改对象。...
“loop:”在Java代码中。这是什么,为什么要编译?
java.lang.ClassNotFoundException:sun.jdbc.odbc.JdbcOdbc...