Angular 应为0个参数,但在ionic 3提供程序可注入问题中得到1

Angular 应为0个参数,但在ionic 3提供程序可注入问题中得到1,angular,typescript,ionic-framework,ionic3,angular6,Angular,Typescript,Ionic Framework,Ionic3,Angular6,当我尝试从Angular web app服务在ionic provider中添加api连接部分时,它显示了预期的0个参数,但在这里得到了1个: @Injectable({ providedIn: 'root' }) 而在Angular web项目中也是如此 Ionic3提供程序如下所示: import { HttpClient } from '@angular/common/http'; import { Injectable } from '@angular/core'; import

当我尝试从Angular web app服务在ionic provider中添加api连接部分时,它显示了预期的0个参数,但在这里得到了1个:

@Injectable({
  providedIn: 'root'
})
而在Angular web项目中也是如此

Ionic3提供程序如下所示:

import { HttpClient } from '@angular/common/http';
import { Injectable } from '@angular/core';
import { Observable } from 'rxjs/Observable';

const BASEURL = 'http://domain...';

@Injectable({
  providedIn: 'root'
})
export class AuthProvider {
  constructor(private http: HttpClient) { }

  RegisterUser(body): Observable<any> {
    return this.http.post(`${BASEURL}/register`, body);
  }

  LoginUser(body): Observable<any> {
    return this.http.post(`${BASEURL}/login`, body);
  }
}
从'@angular/common/http'导入{HttpClient};
从“@angular/core”导入{Injectable};
从“rxjs/Observable”导入{Observable};
常量BASEURL=http://domain...';
@注射的({
providedIn:'根'
})
导出类身份验证提供程序{
构造函数(私有http:HttpClient){}
注册器(主体):可观察{
返回这个.http.post(`${BASEURL}/register`,body);
}
登录用户(主体):可观察{
返回这个.http.post(`${BASEURL}/login`,body);
}
}
如何修复此问题?

更改此问题:

(在angular 6中新增,在ionic 3中不起作用)

对此

@Injectable()

升级到爱奥尼亚4

如果没有“根目录”中提供,它会工作吗?因为在Angular中使用了它。@NewTechLover看看这个@NewTechLover ionic 3并不正式支持Angular 6
@Injectable()