Ionic Angular - Error: Type GooglePlus does not have 'ɵmod' property
Ionic Angular - Error: Type GooglePlus does not have 'ɵmod' property
如果没有出现此错误,我将无法导入 GooglePlus。
控制台错误
ERROR Error: Uncaught (in promise): Error: Type GooglePlus does not
have 'ɵmod' property.
getNgModuleDef@http://localhost:8100/vendor.js:57098:15
recurse@http://localhost:8100/vendor.js:81227:35
recurse@http://localhost:8100/vendor.js:81238:24
tab1/tab1.module.ts
...
import { Tab1PageRoutingModule } from './tab1-routing.module';
import { GoogleSignupComponent } from './google-signup/google-signup.component';
import { GooglePlus } from '@ionic-native/google-plus/ngx';
@NgModule({
imports: [
...
Tab1PageRoutingModule,
GooglePlus
],
declarations: [Tab1Page, GoogleSignupComponent],
})
export class Tab1PageModule { }
tab1/google-signup/google-signup.component.ts
...
import { GooglePlus } from '@ionic-native/google-plus/ngx';
@Component({
selector: 'app-google-signup',
templateUrl: './google-signup.component.html',
styleUrls: ['./google-signup.component.scss'],
})
export class GoogleSignupComponent implements OnInit {
constructor(private googlePlus: GooglePlus) { }
ngOnInit() { }
public google() {
console.log('google signup');
this.googlePlus.login({})
.then(res => console.log(res))
.catch(err => console.error(err));
}
...
}
我正在使用:
- angular11
- "@ionic-native/google-plus": "^5.33.0"
- "cordova-plugin-googleplus": "^8.5.2",
您正在尝试在 ngModule
导入中导入 GooglePlus
。没有这个必要。 Docs
编辑:
有时您需要将插件作为 provider
添加到您的 ngModule
。你可以试试这个:
@NgModule({
imports: [...],
providers: [GooglePlus],
...
如果没有出现此错误,我将无法导入 GooglePlus。
控制台错误
ERROR Error: Uncaught (in promise): Error: Type GooglePlus does not have 'ɵmod' property. getNgModuleDef@http://localhost:8100/vendor.js:57098:15 recurse@http://localhost:8100/vendor.js:81227:35 recurse@http://localhost:8100/vendor.js:81238:24
tab1/tab1.module.ts
...
import { Tab1PageRoutingModule } from './tab1-routing.module';
import { GoogleSignupComponent } from './google-signup/google-signup.component';
import { GooglePlus } from '@ionic-native/google-plus/ngx';
@NgModule({
imports: [
...
Tab1PageRoutingModule,
GooglePlus
],
declarations: [Tab1Page, GoogleSignupComponent],
})
export class Tab1PageModule { }
tab1/google-signup/google-signup.component.ts
...
import { GooglePlus } from '@ionic-native/google-plus/ngx';
@Component({
selector: 'app-google-signup',
templateUrl: './google-signup.component.html',
styleUrls: ['./google-signup.component.scss'],
})
export class GoogleSignupComponent implements OnInit {
constructor(private googlePlus: GooglePlus) { }
ngOnInit() { }
public google() {
console.log('google signup');
this.googlePlus.login({})
.then(res => console.log(res))
.catch(err => console.error(err));
}
...
}
我正在使用:
- angular11
- "@ionic-native/google-plus": "^5.33.0"
- "cordova-plugin-googleplus": "^8.5.2",
您正在尝试在 ngModule
导入中导入 GooglePlus
。没有这个必要。 Docs
编辑:
有时您需要将插件作为 provider
添加到您的 ngModule
。你可以试试这个:
@NgModule({
imports: [...],
providers: [GooglePlus],
...