Angular 离子角度-错误:GooglePlus类型没有'ɵ;mod';财产
我无法导入GooglePlus而不出现此错误 控制台错误Angular 离子角度-错误:GooglePlus类型没有'ɵ;mod';财产,angular,ionic-framework,ionic5,google-plus-signin,Angular,Ionic Framework,Ionic5,Google Plus Signin,我无法导入GooglePlus而不出现此错误 控制台错误 ... import { Tab1PageRoutingModule } from './tab1-routing.module'; import { GoogleSignupComponent } from './google-signup/google-signup.component'; import { GooglePlus } from '@ionic-native/google-plus/ngx'; @NgModule({
...
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 { }
...
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));
}
...
}
错误:未捕获(承诺中):错误:类型GooglePlus不允许
拥有“ɵmod”属性。
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 { }
...
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));
}
...
}
tab1/googlesignup/googlesignup.component.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 { }
...
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));
}
...
}
我正在使用:
- 角度11
- @ionic native/google plus:“^5.33.0”
- “cordova插件Google Plus”:“^8.5.2”
ngModule
导入中导入GooglePlus
。没有这个必要
编辑:
有时您需要将插件作为提供者添加到ngModule
。你可以试试这个:
@NgModule({
imports: [...],
providers: [GooglePlus],
...