Ionic Angular - 错误:类型 GooglePlus 没有“?mod”属性

Van*_*anz 1 ionic-framework google-plus-signin angular ionic5

我无法在不出现此错误的情况下导入 GooglePlus。

\n

控制台错误

\n
\n

错误错误:未捕获(承诺):错误:类型 GooglePlus 不\n具有“\xc9\xb5mod”属性。\ngetNgModuleDef@http://localhost:8100/vendor.js:57098:15\nrecurse@http://本地主机:8100/vendor.js:81227:35\nrecurse@http://localhost:8100/vendor.js:81238:24

\n
\n

tab1/tab1.module.ts

\n
...\nimport { Tab1PageRoutingModule } from './tab1-routing.module';\nimport { GoogleSignupComponent } from './google-signup/google-signup.component';\nimport { GooglePlus } from '@ionic-native/google-plus/ngx';\n\n@NgModule({\n  imports: [\n    ...\n    Tab1PageRoutingModule,\n    GooglePlus\n  ],\n  declarations: [Tab1Page, GoogleSignupComponent],\n})\nexport class Tab1PageModule { }\n
Run Code Online (Sandbox Code Playgroud)\n

tab1/google-signup/google-signup.component.ts

\n
...\nimport { GooglePlus } from '@ionic-native/google-plus/ngx';\n@Component({\n  selector: 'app-google-signup',\n  templateUrl: './google-signup.component.html',\n  styleUrls: ['./google-signup.component.scss'],\n})\nexport class GoogleSignupComponent implements OnInit {\n\n  constructor(private googlePlus: GooglePlus) { }\n\n  ngOnInit() { }\n\n  public google() {\n    console.log('google signup');\n    this.googlePlus.login({})\n      .then(res => console.log(res))\n      .catch(err => console.error(err));\n  }\n  ...\n}\n
Run Code Online (Sandbox Code Playgroud)\n

我在用:

\n
    \n
  • 角11
  • \n
  • "@ionic-native/google-plus": "^5.33.0"
  • \n
  • "cordova-plugin-googleplus": "^8.5.2",
  • \n
\n

Dav*_* B. 7

您正在尝试导入GooglePlus您的ngModule导入内容。没有必要这样做。文档

编辑:

有时您需要为provider您的ngModule. 你可以试试这个:

@NgModule({
imports: [...],
providers: [GooglePlus],
...
Run Code Online (Sandbox Code Playgroud)