Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/ionic-framework/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Angular Ionic v4登录页错误地扩展了基类,超级注入器调用未定义_Angular_Ionic Framework_Ionic4 - Fatal编程技术网

Angular Ionic v4登录页错误地扩展了基类,超级注入器调用未定义

Angular Ionic v4登录页错误地扩展了基类,超级注入器调用未定义,angular,ionic-framework,ionic4,Angular,Ionic Framework,Ionic4,我正在尝试使用ionic v4的基类,使用以下脚本添加我在应用程序中使用的所有服务: 对于基类: import { Injectable } from '@angular/core'; @Injectable() export abstract class BaseClass { constructor(private gateway: GatewayService){ } } 在登录页面中,我使用了超级注射器: export class LoginPage extends Base

我正在尝试使用ionic v4的基类,使用以下脚本添加我在应用程序中使用的所有服务:

对于基类:

import { Injectable } from '@angular/core';

@Injectable()
export abstract class BaseClass {
  constructor(private gateway: GatewayService){
  }
}
在登录页面中,我使用了超级注射器:

export class LoginPage extends BaseClass implements OnInit {
  loginForm: FormGroup;
  message: string="";
  constructor(private gateway: GatewayService) { 
      super(gateway);
    }
...
}
我遇到的两个问题是:

  • LoginPage类上的错误说明:
  • 类“LoginPage”错误地扩展了基类“BaseClass”。类型 单独声明私有财产“网关”

  • 我不能像在以前版本的ionic中那样使用这个.gateway.call()
  • 我在基类中尝试的内容如下:

    constructor(private injectorObj: Injector, private gateway: GatewayService){
        this.gateway = this.injectorObj.get(GatewayService);
    }
    

    但是仍然有相同的错误

    使网关属性受保护。在两个构造函数上